1 (edited by Re-searcher 2025-02-26 20:05:56)

Topic: Bigger grid dots

Hello,

Bigger grid dots

I have see that my backgroud of the screen is an raster.
I have found the solution for making the dots bigger in the grid raster.

I noticed that my screen background is a grid.
I found the solution to make the dots in the grid larger.

The file Diagram.cpp is located in /qelectrotech-source-mirror/sources/
The file elementview.cpp is located in /qelectrotech-source-mirror/sources/editor

My directory(folder) is different in the patch file

Erik

Post's attachments

Attachment icon diagram.cpp.patch 423 b, 8 downloads since 2025-03-26 

Attachment icon elementview.cpp.patch 947 b, 6 downloads since 2025-03-26 

I am an pre-retired industrial developer technician and born in 1960

2

Re: Bigger grid dots

Hello Erik,

see https://github.com/qelectrotech/qelectr … onpage.cpp
for add and use case tro select your new grid size.

After you use this example for add include and your new value in other file code part, see
https://github.com/qelectrotech/qelectr … et.cpp#L39


Best regards,
Laurent

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

3

Re: Bigger grid dots

Created a PR at github for variable setting of grid-point-size.

Adjusted Erik's suggestion to be variable and have the possibility to set the value on general configuration-page and save setting in settings-file.

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

4

Re: Bigger grid dots

@plc-user

Your changed code does NOT WORK

I am an pre-retired industrial developer technician and born in 1960

5

Re: Bigger grid dots

Would not have published that code, if it didn't work!
you need to zoom in or out once, after changing the setting to see the changes

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

6

Re: Bigger grid dots

some settings changed in forum: can only attach one file per post...
Here the same view with setting: 5px
note: there are some optical artifacts because of zoom-factor

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

7

Re: Bigger grid dots

Works also on win.

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

8

Re: Bigger grid dots

@plc-user

Your changed code does NOT WORK

I am using here Linux/GNU Debian Trixie.

When i change 1 to 5 in my code have I non optical artifacts in the zoom-factor.

I am an pre-retired industrial developer technician and born in 1960

9

Re: Bigger grid dots

@Re-searcher:
There is no need to shout!
I can read small letters, too!

What version of QElectroTech do you use?
Add screenshots of settings and grid to your next post.

I use Debian GNU/Linux trixie/sid and most recent QET-version from repository and also tried last binary from QET-download-site for windows this morning:
On both systems:
Changing grid-point-size works perfectly!

Maybe another user can share his/her experience with changing grid-points, too?

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

10

Re: Bigger grid dots

Here it's work on my UHD screen..

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

11

Re: Bigger grid dots

... works also in element-editor:

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

12

Re: Bigger grid dots

An explanation:
The height and width of the grid-points does not grow with zoom-factor in QET!
It is always the number of pixels on your screen for width/height of the grid-points.
Maybe a maximum of "5" isn't enough for High-DPI-Screens. But that could be changed very easily in sources...

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

13

Re: Bigger grid dots

@plc-user

I always use the latest code

In the diagram editor
When zooming in, U points become larger.
When zooming out, U points become smaller.
see picture

This is not in my code
The points are same when zooming in and out

I am an pre-retired industrial developer technician and born in 1960

14

Re: Bigger grid dots

@Re-searcher:

I do not know, what you are complaining about:
The settings does exactly, what it is made for: "Set the grid-dot-size to the value in the spinbox"
It looks like you chose a setting of "5" for the screenshots you made.
When I look at your screenshots, all grid-dots in both screenshots have the same height and width of 5x5.

And as written before:
The size of the grid-points does not change with zoom-factor in QET!

In relation the points look smaller, when zooming in a design.
But that's just an optical illusion:
Use a graphic-software to check the size in both screenshots!
You will see, that all points have the same size of "5x5" in your screenshots.

In the attachment you see both of your screenshots zoomed to 1200% with GIMP (no shouting here: it spells with capital letters).
I marked the diagonal of your black dots with red pixels, so you can count: 5 in each of your screenshots.

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

15

Re: Bigger grid dots

@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!

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

16

Re: Bigger grid dots

I 'am using the number 1 in my version

The same size as the conductor and terminal

I haven non optical artifacts in the zoom-factor.

Now with blue points.

I am an pre-retired industrial developer technician and born in 1960

17

Re: Bigger grid dots

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!

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

18

Re: Bigger grid dots

Problem with uploading image.

Warning! The following errors must be corrected before your message can be posted:

    The server was unable to save the uploaded file. Please contact the forum administrator at scorpio@qelectrotech.org.


@plc-user

U weigert gewoon om iemand anders zijn code te gebruiken.
You simply refuse to use anyone else's code.
Vous refusez tout simplement d'utiliser le code de quelqu'un d'autre.



I 'am using the number 1 in my version
Warning! The following errors must be corrected before your message can be posted:

    The server was unable to save the uploaded file. Please contact the forum administrator at scorpio@qelectrotech.org.



U weigert gewoon om iemand anders zijn code te gebruiken.
You simply refuse to use anyone else's code.
Vous refusez tout simplement d'utiliser le code de quelqu'un d'autre.


test my code

I 'am using the number 1 in my version
The same size as the conductor and terminal
I haven non optical artifacts in the zoom-factor.

I am an pre-retired industrial developer technician and born in 1960

19

Re: Bigger grid dots

Re-searcher wrote:

Problem with uploading image.

Warning! The following errors must be corrected before your message can be posted:

    The server was unable to save the uploaded file. Please contact the forum administrator at scorpio@qelectrotech.org.


@plc-user

U weigert gewoon om iemand anders zijn code te gebruiken.
You simply refuse to use anyone else's code.
Vous refusez tout simplement d'utiliser le code de quelqu'un d'autre.



I 'am using the number 1 in my version
Warning! The following errors must be corrected before your message can be posted:

    The server was unable to save the uploaded file. Please contact the forum administrator at scorpio@qelectrotech.org.



U weigert gewoon om iemand anders zijn code te gebruiken.
You simply refuse to use anyone else's code.
Vous refusez tout simplement d'utiliser le code de quelqu'un d'autre.


test my code

I 'am using the number 1 in my version
The same size as the conductor and terminal

Hello Erik,

please try to stay calm, nomicons/wink

Your post is complicated for me to understand, as I'm not in the best of health at the moment. You write the same thing several times and you're constantly changing the subject!

Please dont mixing language, it isn't usefull!

As for the pîctures yes there was a problem on the forum yesterday, now some pictures didn't works, I think you'll have to add them again, sorry.

Best regards,
Laurent!

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

20

Re: Bigger grid dots

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

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

21

Re: Bigger grid dots

@ plc-user

Diagram.cpp
Dit is mijn geboorte taal.
U begrijpt het nog altijd niet.
U vergelijkt appelen met peren.
Ik heb U ook verteld gehad dat bij mij het cijfer 1 overeenkomt met de terminal en conductor breedte.Bij U is dat niet zo.
Als ik het cijfer 2 gebruikt dat is dat veel te groot.Daarom heb ik niet andere waarden nodig.
Ik heb ook geen visuele verandering van de punten op het scherm bij het verkeinen en uitvergroten (zomen)

QPen pen en QPen point is niet hetzelfde.Wanneer wilt U dat eens begrijpen.


elementview.cpp
Dit moet nog veranderd worden. zoals in de Diagram.cpp

U sprak ook over een UHD monitor.
Op dit moment heb ik geen UHD monitor.
Heb een 16:10 ; 1680x1050 als maximum pixels = WSXGA+
Textformaat 9 is veel te klijn om te gebruiken in deze resolutie.
Textformaat 9 komt uit de tijd van het 4:3 1024x768 = XGA en nog eerder.
Voor te testen van QET gebruik ik 16:10 1280x800 = WXGA

Heb nog geen tekenig gemaakt in QET.Ik gebruik Eplan Education daarvoor.

Ben van plan om een fork van QET te maken.




Diagramme.cpp
C'est ma langue maternelle.
Vous ne la comprenez toujours pas.
Vous comparez des pommes à des oranges.
Je vous ai également dit que pour moi, le chiffre 1 correspond à la largeur du point de connexion et du conducteur, ce qui n'est pas le cas pour vous.
Si j'utilise le chiffre 2, qui est beaucoup trop grand, je n'ai pas besoin de valeurs différentes.
Je n'ai pas non plus de changement visuel des points à l'écran lors du redimensionnement et de l'agrandissement.

QPen pen et QPen point ne sont pas la même chose.


elementview.cpp
Ceci doit encore être ajusté, comme dans le fichier Diagram.cpp.

Vous avez également mentionné un moniteur UHD.
Pour l'instant, je n'ai pas de moniteur UHD.
J'ai un écran 16:10 ; 1680x1050 pixels maximum = WSXGA+.
Le format de texte 9 est beaucoup trop restrictif pour être utilisé dans cette résolution.
Le format de texte 9 remonte à l'époque du 4:3 1024x768 = XGA et même avant.
Pour tester QET, j'utilise 16:10 1280x800 = WXGA.

Je n'ai pas encore créé de schematic dans QET, j'utilise pour cela Eplan Education.

J'ai l'intention de faire un fork de QET.

I am an pre-retired industrial developer technician and born in 1960

22 (edited by plc-user 2025-03-24 19:54:16)

Re: Bigger grid dots

@Re-searcher:

Wenn Du nichts erklärst, kann niemand nachvollziehen, was du meinst!
Ich habe es nicht nötig, hier von irgendwem angeschrieen und beleidigt zu werden und werde nichts mehr zu diesem Thema beitragen!
Nur noch eins: Mit Deiner Aussage zu QPen hast Du Unrecht!

via online-translator:

If you don't explain anything, nobody can understand what you mean!
I don't need to be shouted at and insulted by anyone here and won't say anything more on this subject!
Just one thing: You are wrong with your statement about QPen!

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

23

Re: Bigger grid dots

@plc-user

Ik weet wat het probleem is.U gebruikt het programma in de duitse taal.
Het programma is geschreven in de franse en engelse taal.
Het wordt eens tijd dat U het prograam analyseerd.
Ik heb mijn programma in de engelse taal staan.

Borne = Terminal = Anschluss

U hebt het program QET_ElementScaler zelf in de engelse taal staan.

In de documentation van QPen Class | Qt GUI 5.15.18 = https://doc.qt.io/qt-5/qpen.html
staat het volgende geschreven :

QPainter painter(this);
QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin);
painter.setPen(pen);

Men is niet verplicht om pen te gebuiken in Qpen

U zegt dat ik verkeerd met de verklaring over QPen!
U hebt zelfs mijn kleine program niet getest , dan maar zeggen dat ik onkelijk heb.
Als U het getest hebt dan weet U dat ik gelijk heb.
Ik heb het eerst getest met QPen pen te gebruiken,maar op het scherm was het slecht.
Ik gebruik point voor het printen van de points op het scherm.
Maar als ik QPen point gebruik dan klopt mijn verklaring.

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

Ik kan ook 1.0 gebruiken in de code.

Xavier de opricher van het programma gebruikt QPen t ; dit is t voor terminal
De breedte is 1.0
Hij is begonnen met 0.1 versie.Men vindt dat hier ook terug en ook in de laatste versie 0.100

In versie 0.100 op lijn 84 = QPen t; en breedte = 1.0
//sources/editor/graphicspart/partterminal.cpp


Je connais le problème : vous utilisez le programme en allemand.
Le programme est écrit en français et en anglais.
Il est temps d'analyser le programme.
J'ai mon programme en anglais.

Borne = Terminal = Anschluss

Vous avez le programme QET_ElementScaler lui-même en anglais.

Dans la documentation de QPen Class | Qt GUI 5.15.18 = https://doc.qt.io/qt-5/qpen.html
il est écrit ce qui suit :

QPainter painter(this) ;
QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin) ;
painter.setPen(pen) ;

Il n'est pas nécessaire d'utiliser le stylo dans Qpen

Vous dites que j'ai tort avec l'affirmation sur QPen !
Vous n'avez même pas testé mon petit programme et vous vous contentez de dire que je suis inconnaissable.
Si vous l'avez testé, vous savez que j'ai raison.
Je l'ai d'abord testé en utilisant le stylo QPen, mais l'affichage à l'écran était mauvais.
J'utilise le point pour imprimer les points sur l'écran.
Mais si j'utilise QPen point, ma déclaration est correcte.

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

Je peux aussi utiliser 1.0 dans le code.

Xavier, l'auteur du programme, utilise QPen t ; il s'agit de t pour terminal.
La largeur est de 1.0
Il a commencé avec la version 0.1. On retrouve cela ici et aussi dans la dernière version 0.100

Dans la version 0.100 à la ligne 84 = QPen t ; et largeur = 1.0
//sources/editor/graphicspart/partterminal.cpp

Post's attachments

Attachment icon Diagram-Point-zoom-in-erik.png 12.03 kb, file has never been downloaded. 

I am an pre-retired industrial developer technician and born in 1960

24

Re: Bigger grid dots

@All:
Can someone please explain C/C++-Basics to Re-searcher!

@Re-searcher:

What you are doing is only define a new variable of the type "QPen" with the name "point" and the properties "color=Qt::black" and "penWidth=1"

If it were right what you say, that a variable has different properties, when you use another name:
Call your QPen "Superman" and the grid-points will fly!!!

By declaring and using a new QPen, you totally ignore all other settings, that are made to the QPen in the beginning of the function "Diagram::drawBackground" and use the default-values for Qt::PenStyle, Qt::PenCapStyle and Qt::PenJoinStyle!


Please learn the basic basics of C/C++ for declaring variables, before shouting and yelling:
https://www.learncpp.com/cpp-tutorial/v … alization/

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !