Topic: Element Style Colors

Hi Everyone,

I was recently doing some work to improve the styling support in dxf2elmt, and while looking at the element files and the QET code, I noticed that the Line and fill colors are stored in the XML as a string with a name such as "red", and "HTMLWhiteFloralWhite", etc.

I was wondering if there was a specific reason this was stored this way, and the colors in the element editor are just a drop down of options, instead of a color picker, and storing the RGB values in the element file?

Re: Element Style Colors

Hallo Vadoola,

see https://github.com/search?q=repo%3Aqele … ;type=code

Like :

{"HTMLWhiteFloralWhite",
869                             {Qt::SolidPattern, QColor(255, 250, 240)}},

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

Re: Element Style Colors

Hi Vadoola!
Salut Laurent !

I guess it is just because to have colors with names and Qt has defined some:
Look here: https://doc.qt.io/archives/qt-5.15/qml-color.html

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 !

Re: Element Style Colors

Salut Laurent,

scorpio810 wrote:

Hallo Vadoola,

see https://github.com/search?q=repo%3Aqele … ;type=code

Like :

{"HTMLWhiteFloralWhite",
869                             {Qt::SolidPattern, QColor(255, 250, 240)}},

Sorry for the misunderstanding, I had already found that section of code, and added in appropriate conversions in dxf2elmt, I was more curious if there was some particular reason it was done that way.


plc-user wrote:

I guess it is just because to have colors with names and Qt has defined some:
Look here: https://doc.qt.io/archives/qt-5.15/qml-color.html

It's certainly possible I guess, but as far as I understand QET doesn't use any QML, and it looks like QColor only defines a handful of basic colors like red, blue, etc. All these colors used by QET are defined in QET, and have different names to the QML ones.

It's certainly not a big deal, what is there functions, and adding in these conversions into dxf2elmt wasn't difficult, it just seemed like a bit of extra work/code that using RGB values, and I was mostly just curious why it was done this way.