[Solved] QPalette and SystemPalette
-
Hello,
First of all, I am new to Qt/QML, so sorry if my post is confusing but I'm confused myself. I'll try to be specific.
I have an app that uses C++/QML integration. I want my visual elements to have a consistent look, so I need to use SystemPalette. For example, if I have in qml:@SystemPalette {id: myPalette; colorGroup: SystemPalette.Active }@
then for some text element I can do:
@Text { id: myText; color: myPalette.text }@
However, the default colors that I get from SystemPalette don't suit my needs.
I read that you can set QPalette colors in the C++ code and then set the custom palette as app palette:@QPalette customPalette = myApp->palette();
customPalette.setColor(QPalette::WindowText, QColor("red"));
myApp->setPalette(customPalette);@but this had no effect for me and I don't see what I am missing here.
My question: Is there a way to change the default SystemPalette colors? Or alternatively, how do I use my customPalette from qml?