Hello Plc-user,
I'm happy to read you are currently working on an elmt to svg converter, and wow very very good job.
About the color : like you say, you can drop it for now.
About text : For historical reason (and bad choices I made), how the texts are managed in the elmt file is a mess.
With the links Laurent give, you can see there is several way how the position of the text are saved, and no one are good in sense of svg.
If you read PartText.cpp, the function toXml, you can see the position x and y is the position of graphicsItem of the text but not the text itself (in the same class read the function void PartText::adjustItemPosition(int new_block_count)).
And in the class PartDynamicTextField it's approximately the same thing.
In svg, the position of the text is the base line https://developer.mozilla.org/en-US/doc … ement/text and the base line is bottom left of the text (like you say in previous post)
So to resume the situation, it will be very difficult for you to convert the "qet" position to "svg" position, withouse the baseline of the current used font. From my point of view try to approximate the position in first time.
One other thing, the text size with Qt (see QFont class info) can be pixel size of point size. Until some year we used default value (point size) and have no problem because QElectroTech was used in with screen with same dpi. But now there is a lot of screens with different dpi and the text are not displayed in same size from screen to another. This is why now (and if we had known that before, we would done it from the start) we use pixel size.
Point size => Same physical size one screen no matter the dpi.
Pixel size => Same pixel size on screen no matter the dpi.
Consider the font size are in pixel size even if it's was not true when the element was saved.
I probably forget some information don't hesitate to ask us.
I don't know if you are aware or not but in future (long ?) I plan to rewrite a large part of QElectroTech (To solve lot of problem, bad choice, base design, etc...) one point of this rewrite is to use true svg for the graphical aspect of element and not an ersatz of it.
May be when this time will come I will used your code for that (if you are ok).
some link about text in Qt
https://doc.qt.io/qt-5/qfont.html
https://doc.qt.io/qt-5/qfontinfo.html
https://doc.qt.io/qt-5/qfontmetricsf.html
Don't forget, we don't draw directly text in the folio, but draw text inside a QGraphicsItem and the position is the position of this item, not the baseline of the text.
https://doc.qt.io/qt-6/qgraphicsitem.html
Joshua