
Originally Posted by
wysota
If it reads the same instance then it means that the operation of reading a
QColor from
QSettings was successfull, doesn't it? If it weren't, the color would be empty.
Of course - in that context. Specifically, I need to read in the color from an INI file entry, not set it in code. The issue is how to form the entry in the key field of the file. For example:
[Testing]
[Testing]
MarkerColor=@QColor(128,0,0)
To copy to clipboard, switch view to plain text mode
That produced Invalid color using the following code
m_MarkerColor = IniSettings.value("Testing/MarkerColor").value<QColor>();
m_MarkerColor = IniSettings.value("Testing/MarkerColor").value<QColor>();
To copy to clipboard, switch view to plain text mode
What I then tried was to leverage off the code presented as a way to see what the INI key would look like on a write - even if I didn't need to store it. I see that I may have not been forming the key properly because upon inspection of the INI file, I saw:
MarkerColor=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\x80\x80\0\0)
MarkerColor=@Variant(\0\0\0\x43\x1\xff\xff\0\0\0\0\x80\x80\0\0)
To copy to clipboard, switch view to plain text mode
from this code that wrote the key prior to exit
IniSettings.setValue("Testing/MarkerColor", finalColor);
QColor finalColor = QColor(0,0,128);
IniSettings.setValue("Testing/MarkerColor", finalColor);
To copy to clipboard, switch view to plain text mode
When I tried to read that key in, I still get Invalid color.
Bookmarks