151

(23 replies, posted in Code)

Hallo Re-searcher!

Lass mich auf Deutsch anfangen, Englisch ist weiter unten.

Worin liegt der Unterschied zwischen diesen beiden Code-Fragmenten für "diagram.cpp":

QPen point(Qt::black, 1);
p -> setPen(point);

und

pen.setWidth(settings.value(QStringLiteral("diagrameditor/grid_pointsize"), 1).toInt());

Ich sehe diese Unterschiede:
Im ersten Fragment wird eine hardcodierte "1" als Stiftbreite eingetragen und im zweiten wird eine Stiftbreite aus der Konfigurationsdatei geladen. Ist kein Wert in der Konfigurationsdatei vorhanden, wird eine "1" eingetragen.

Im Ergebnis steht in beiden Fällen eine "1" als Stiftbreite.

Einen Nachteil hat das erste Code-Fragment aber leider: Es wird eine möglicherweise vorgegebene Stiftfarbe hardcodiert durch "Qt::black" ersetzt!


Nun zur Datei "elementview.cpp".

pen.setWidth(5);

und

pen.setWidth(settings.value(QStringLiteral("diagrameditor/grid_pointsize"), 1).toInt());

Im ersten Fall wird die Stiftbreite hardcodiert auf "5" gesetzt und im zweiten Fall auf den Wert aus der Konfigurationsdatei.


p -> drawLine(QLineF(gx - 0.8, gy, gx + 0.8, gy));
p -> drawLine(QLineF(gx, gy - 0.8, gx, gy + 0.8));

und

p -> drawLine(QLineF(gx - (pen.width()/4.0), gy, gx + (pen.width()/4.0), gy));
p -> drawLine(QLineF(gx, gy - (pen.width()/4.0), gx, gy + (pen.width()/4.0)));

Im ersten Fall wird die Linienlänge um von "-0.8" bis "+0.8" definiert und im zweiten Fall auf "Stiftbreite geteilt durch 4".
Für den Fall "Stiftbreite = 5" ist das Ergebnis identisch.

Zusammenfassung:
In einem Fall sind die Stiftbreiten hardcodiert und im zweiten Fall kommt die Stiftbreite aus der Konfigurationsdatei. Bei gleicher Einstellung für die Stiftbreite ist das Ergebnis auf dem Bildschirm das gleiche.
Seit ein paar Tagen ist die Raster-Punktgröße für den Schaltplaneditor und den Element-Editor sogar getrennt einstellbar, sodass man unterschiedliche Werte haben kann: Zum Beispiel "1" für den Schaltplaneditor und "5" für den Element-Editor, wie es in hardcodiertem Code der Fall wäre.

So ist Deine Idee mit anderer Punktgröße für das Raster in den Quellcode von QElectroTech gelangt, Re-searcher!
Die Ergänzung, daß es konfigurierbar ist, kann für die Benutzer nur von Vorteil sein.

Daß Du keine grafischen Artefakte siehst: Freue Dich doch!
Die fallen je nach Pixelgröße des Bildschirms optisch weniger auf!
Du hat einen UHD-Monitor, nicht wahr?

Ich hoffe, dass mit dieser Erklärung deutlich geworden ist, dass es ausdrücklich nicht darum geht, den Code-Vorschlag von jemandem nicht umzusetzen, sondern für uns und die Nutzer von QET eine gute Lösung zu haben!

Beste Grüße
  plc-user


Online-Translator


Hello Re-searcher!

What is the difference between these two code fragments for "diagram.cpp":

QPen point(Qt::black, 1);
p -> setPen(point);

and

pen.setWidth(settings.value(QStringLiteral("diagrameditor/grid_pointsize"), 1).toInt());

I see these differences:
In the first fragment, a hardcoded "1" is entered as the pen width and in the second, a pen width is loaded from the configuration file. If there is no value in the configuration file, a "1" is entered.

The result in both cases is a "1" as the pen width.

Unfortunately, the first code fragment has one disadvantage: a possibly predefined pen color is hardcoded and replaced by "Qt::black"!


Now to the "elementview.cpp" file.

pen.setWidth(5);

and

pen.setWidth(settings.value(QStringLiteral("diagrameditor/grid_pointsize"), 1).toInt());

In the first case, the pen width is hardcoded to "5" and in the second case to the value from the configuration file.


p -> drawLine(QLineF(gx - 0.8, gy, gx + 0.8, gy));
p -> drawLine(QLineF(gx, gy - 0.8, gx, gy + 0.8));

and

p -> drawLine(QLineF(gx - (pen.width()/4.0), gy, gx + (pen.width()/4.0), gy));
p -> drawLine(QLineF(gx, gy - (pen.width()/4.0), gx, gy + (pen.width()/4.0)));

In the first case, the line length is defined from "-0.8" to "+0.8" and in the second case to "pen width divided by 4".
In the case of "pen width == 5" (as in pen.setWidth(5)), the result is identical.


Summary:
In one case the pen widths are hardcoded and in the second case the pen width comes from the configuration file. With the same setting for the pen width, the result on the screen is the same.
Since a few days, the grid point size for the circuit diagram editor and the element editor can even be set separately, so that you can have different values: For example "1" for the schematic editor and "5" for the element editor, as would be the case in hardcoded code.

This is how your idea with a different point size for the grid got into the source code of QElectroTech, Re-searcher!
The addition that it is configurable can only be an advantage for users.

That you don't see any graphical artifacts: Rejoice!
Depending on the pixel size of the screen, they are less noticeable!
You have a UHD monitor, don't you?

I hope that this explanation has made it clear that it is explicitly not about not implementing someone's code proposal, but about having a good solution for us and the users of QET!

Best regards
  plc-user

152

(41 replies, posted in Code)

@scorpio810:
It's not just about the Registry-script:
It seems that many attachments are lost somehow!

If you look at this post from 20. February:
https://qelectrotech.org/forum/viewtopi … 099#p21099

There should be a png as attachment, but there is only a link!
When I follow the link, it says:

Bad request. The link you followed is incorrect or outdated.

Same here with post from 10. March
https://qelectrotech.org/forum/viewtopi … 220#p21220

Bad request. The link you followed is incorrect or outdated.

153

(41 replies, posted in Code)

@scorpio810:

scorpio810 wrote:

(...) forgot to Refresh hooks in attachments plugin....I'm tired!!!

Something's wrong with the forums' attachments, Laurent!
This afternoon, I attached a file and it was marked as "not allowed to download"
And now I don't see any attachment in the forum!

154

(41 replies, posted in Code)

I can reassure you, Laurent:
I understood that differently, too!

But it doesn't hurt to have such a script...  nomicons/wink

We need to inform the users, that we provide default-fonts for all systems from date x.
And we should also point out that the font should be chosen if users are thinking about or relying on cross-system data exchange.

Do we need to adjust the Elements-Collection, too?
This could be done with a small script, but we would need to agree on which fonts to replace with which others:
Sans Serif or Arial --> Liberation Sans
Serif or Times New Roman --> Liberation Serif
MS Shell Dlg --> ???

156

(16 replies, posted in Scripts)

Information für alle, die hier im Forum konkrete Hilfe erwarten:
Wir brauchen Informationen, welches Betriebssystem und welche QElectroTech-Version Du benutzt!
Erst dann kann es eine spezifische Hilfe geben!
In diesem Fall:

Online-Translator:

Information for all those who expect specific help here in the forum:
We need information about which operating system and which QElectroTech version you are using!
Only then can we provide specific help!
In this case:

Traducteur en ligne :

Information pour tous ceux qui attendent une aide concrète sur ce forum :
Nous avons besoin d'informations sur le système d'exploitation et la version de QElectroTech que tu utilises !
Ce n'est qu'alors qu'il sera possible d'obtenir une aide spécifique !
Dans ce cas :

C:\Documents and Settings\<username>\Application Data\qet

For the time of the changeover to ‘Liberation Sans’ as default-font:
Should we give our win users the option to change the default font to ‘Liberation Sans’ in the registry?
This could be done with a *.bat, *.cmd or *.reg file, I think...

EDIT:
This should be it:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\QElectroTech\QElectroTech]
"diagramitemfont"="Liberation Sans"
"diagramitemsize"=dword:00000009
"diagramitemstyle"="Regular"
"diagramitemweight"=dword:00000032


[HKEY_CURRENT_USER\Software\QElectroTech\QElectroTech\diagrameditor]
"dynamic_text_font"="Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular"
"independent_text_font"="Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular"

cite from Bugtracker:

Workaround:
- Download however you prefer, FireFox, Safari, etc
- Expand the arm64 zip with terminal: unzip qelectrotech-xxxxxxx-arm64.zip
- Launch .app as usual, and be presented with confirmation to open a functioning application with proper validation

I noticed that downloading the ARM64 archive and expanding with the double-click Archive Utility, the resultant application reports as corrupt. I'm not sure why exactly. Clearly there are differences between the terminal application and the GUI Archive Utility - I'm sure there are reasons.

https://github.com/qelectrotech/qelectr … issues/307

Free software should only use free "ingredients"!

Therefore:
We are on a very good way to solve this age-old problem!

You're not living up to your name at the moment:  nomicons/wink
It looks like, you did not read the last few posts in this thread!

161

(23 replies, posted in Code)

plc-user wrote:

@Re-searcher:
You still did not explain, what you think does "not work" with bigger grid-points.
You need to explain, what you expect to see with bigger points!

If you can't or won't explain what you expect, no one can help you!

The implementation of texts and fonts is not finished in dxf2elmt.
That is why the font selection can still be described as hardcoded and “temporary”!

There is no need to hurry, Laurent!

EDIT:

scorpio810 wrote:

so I'll give you my consent if anyone wants to do it.

elevatormind already included the fonts in his "liberation-fonts"-Branch and I added a patch for setting default-font to "Liberation Sans" here. See above


But to repeat the reasons, why delivering a few fonts with QET is a good idea:

The user still has complete freedom to do whatever he wants!
If he wants to be compatible with different systems, it is suggested to use the fonts that QET provides.
If he wants to use other fonts, he can and may of course continue to do so!
He just needs to be aware that the particular font he has selected may not be available on other systems. This may even be the case if he re-installs his operating system.
That's why we supply a few fonts that can be used in addition to the fonts already available in the system!

There will be no limitation!
It is not so, that we only have the fonts available to use, which are coming with QET:
Still all fonts available on your system can be chosen to use with texts in QET.
So in this point there would be no change to the user!
And if the user is upgrading the QET-version and has set some font in Config-Page they wouldn't even notice a change!

165

(41 replies, posted in Code)

Lade doch erstmal nur den Quellcode inklusive einer kurzen Beschreibung in einem Post hoch.
Damit können wir doch schon mal anfangen...

Do you think, we should include Symbol-Fonts, too, Laurent?
That would "blow-up" the binary of QET even more!

As already said: I would limit the number of fonts to three Liberation-Fonts (or four including osifont) to have the basic fonts available on all systems with the default set to one of these.
That will possibly be enough for 90% of our users, I think.

And with the possibility to enter/display unicode-signs even with Liberation we'll have many symbols "on board". Sample in screenshot.

167

(41 replies, posted in Code)

Git ist eine Versions-Verwaltung für Quellcode und github ist ein Onlinedienst zur gemeinschaftlichen Versionsverwaltung für Softwareprojekte.
Quelle: Wikipedia

Dort stellst Du primär den Quellcode nebst einer Beschreibung Deiner Anwendung zur Verfügung.

Wenn es Abhängigkeiten gibt, müssen die natürlich irgendwie ersichtlich sein: "RTFM" geht nur, wenn es auch "FM" gibt!

Dort können auch Releases veröffentlicht werden, die als Binärpakete (in Deinem Fall ein AppImage) verfügbar sind.

168

(41 replies, posted in Code)

Im günstigsten Fall hast Du einen github-Account, auf dem Du Sourcecode und Releases veröffentlichst.
Dann kann sich jeder den Quellcode anschauen, weiter verbessern, PullRequests erstellen, etc. pp.

@elevatormind:

elevatormind wrote:

It should definitely be the default font in QET as you say though, otherwise people will probably not use it.

Based on your “liberation-fonts” branch including osifont, I have implemented the setting of the default font to "Liberation Sans, 9, Regular"in QET.
As I believe this is inseparable from each other, I am providing the patch here for you to integrate it.

diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp
--- a/sources/qetapp.cpp    2025-03-13 22:43:33.000000000 +0100
+++ b/sources/qetapp.cpp    2025-03-14 16:41:05.253397571 +0100
@@ -1236,7 +1236,7 @@
 /**
     @brief QETApp::diagramTextsFont
     The font to use
-    By default the font is "sans Serif" and size 9.
+    By default the font is "Liberation Sans" and size 9.
     @param size : the size of font
     @return the font to use
 */
@@ -1246,7 +1246,7 @@
 
     //Font to use
     QString diagram_texts_family = settings.value("diagramfont",
-                              "Sans Serif").toString();
+                              "Liberation Sans").toString();
     qreal diagram_texts_size     = settings.value("diagramsize",
                               9.0).toDouble();
 
@@ -1272,14 +1272,14 @@
 
     //Font to use
     QString diagram_texts_item_family = settings.value("diagramitemfont",
-                               "Sans Serif").toString();
+                               "Liberation Sans").toString();
     qreal diagram_texts_item_size     = settings.value("diagramitemsize",
                                9.0).toDouble();
     auto diagram_texts_item_weight =
             static_cast<QFont::Weight>(
                 settings.value("diagramitemweight", QFont::Normal).toInt());
     QString diagram_texts_item_style  = settings.value("diagramitemstyle",
-                               "normal").toString();
+                               "Regular").toString();
 
     if (size != -1.0) {
         diagram_texts_item_size = size;
diff -r -u a/sources/ui/configpage/generalconfigurationpage.cpp b/sources/ui/configpage/generalconfigurationpage.cpp
--- a/sources/ui/configpage/generalconfigurationpage.cpp    2025-03-13 22:43:33.000000000 +0100
+++ b/sources/ui/configpage/generalconfigurationpage.cpp    2025-03-14 17:26:10.217643923 +0100
@@ -86,13 +86,11 @@
     ui->m_border_0->setChecked(settings.value("border-columns_0", false).toBool());
     ui->m_autosave_sb->setValue(settings.value("diagrameditor/autosave-interval", 0).toInt());
     
-    QString fontInfos = settings.value("diagramitemfont").toString() + " " +
-            settings.value("diagramitemsize").toString() + " (" +
-            settings.value("diagramitemstyle").toString() + ")";
+    QString fontInfos = settings.value("diagramitemfont", "Liberation Sans").toString() + " " +
+            settings.value("diagramitemsize", "9").toString() + " (" +
+            settings.value("diagramitemstyle", "Regular").toString() + ")";
     ui->m_font_pb->setText(fontInfos);
 
-    
-    
 
         //Dynamic element text item
     ui->m_dyn_text_rotation_sb->setValue(settings.value("diagrameditor/dynamic_text_rotation", 0).toInt());
@@ -106,7 +104,7 @@
                 QString::number(font.pointSize()) + " (" +
                 font.styleName() + ")";
         ui->m_dyn_text_font_pb->setText(fontInfos);
-    }
+    } else { ui->m_dyn_text_font_pb->setText("Liberation Sans 9 (Regular)"); }
 
         //Independent text item
     ui->m_indi_text_rotation_sb->setValue(settings.value("diagrameditor/independent_text_rotation",0).toInt());
@@ -119,7 +117,7 @@
                             QString::number(font.pointSize()) + " (" +
                             font.styleName() + ")";
         ui->m_indi_text_font_pb->setText(fontInfos);
-    }
+    } else { ui->m_indi_text_font_pb->setText("Liberation Sans 9 (Regular)"); }
     
     ui->m_highlight_integrated_elements->setChecked(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
     ui->m_default_elements_info->setPlainText(settings.value("elementeditor/default-informations", "").toString());
@@ -399,7 +397,9 @@
 {
     bool ok;
     QSettings settings;
-    QFont font = QFontDialog::getFont(&ok, QFont("Sans Serif", 9), this);
+    QString currentFont = settings.value("diagramitemfont", "Liberation Sans").toString();
+    int currentPointSize = settings.value("diagramitemsize", "9").toInt();
+    QFont font = QFontDialog::getFont(&ok, QFont(currentFont, currentPointSize), this);
     if (ok)
     {
         settings.setValue("diagramitemfont", font.family());
@@ -421,7 +421,9 @@
 {
     bool ok;
     QSettings settings;
-    QFont font = QFontDialog::getFont(&ok, QFont("Sans Serif", 9), this);
+    QFont curFont;
+    curFont.fromString(settings.value("diagrameditor/dynamic_text_font", "Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular").toString());
+    QFont font = QFontDialog::getFont(&ok, QFont(curFont.family(), curFont.pointSize()), this);
     if (ok)
     {
         settings.setValue("diagrameditor/dynamic_text_font", font.toString());
@@ -510,7 +512,9 @@
 {
     bool ok;
     QSettings settings;
-    QFont font = QFontDialog::getFont(&ok, QFont("Sans Serif", 9), this);
+    QFont curFont;
+    curFont.fromString(settings.value("diagrameditor/independent_text_font", "Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular").toString());
+    QFont font = QFontDialog::getFont(&ok, QFont(curFont.family(), curFont.pointSize()), this);
     if (ok)
     {
         settings.setValue("diagrameditor/independent_text_font", font.toString());

At the same time, this also corrects an unattractive feature: When setting the font, the font dialog did not scroll to the current font, but always displayed the default font.


EDIT:
About the licenses: Do you think it is possible to have only one "tab" for all licenses?
The QET-License should of course be the first to display, but I like the idea with the combobox to choose others to view.

EDIT again:
Already have a solution for only having one license tab in about-dialog.
Just waiting for your PR for including the fonts, elevatormind, nomicons/wink

170

(16 replies, posted in Scripts)

That's why i'm asking which system and what QET-version you have!
We support several systems here, where the files are located in different directories!

You have to help with information so that we can help you!

171

(16 replies, posted in Scripts)

search your system for "nomenclature.json" or "summary.json"

172

(16 replies, posted in Scripts)

How can I tell, if you have not yet provided any information about your system!
OS, QET-Version, ...

173

(41 replies, posted in Code)

All the best for your health, Laurent!

Ok, so you don't have any problem with different looking fonts on different systems, Achim?

I tried PDF-Export with osifont used as Element-Text. (You might recognize, Achim)
To me it looks like it works perfectly:
osifont is not installed on the system – just used from within QET.

175

(16 replies, posted in Scripts)

That is not yet implemented.

You can overwrite entries with empty strings or you can edit the corresponding json file directly with a text editor.
The json-files are located in configuration-dir.