QGuiApplication palette not set to ApplicationWindow
-
Re: QQuickView change controls palette
It looks like the ApplicationWindow is not affected by the QGuiApplication's palette values.
My environment is Qt 5.12.5 on Linux. I started over with an empty project to make sure of my results.main.cpp:
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QPalette palette = QGuiApplication::palette(); QPalette newPalette(palette); newPalette.setColor(QPalette::ColorRole::WindowText, QColor("#00FF00")); QGuiApplication::setPalette(newPalette);
main.qml:
ApplicationWindow { visible: true width: 640 height: 480 Component.onCompleted: { console.log("Text color : " + palette.windowText) } Text { text : "hello" } }
Logs "Text color : #26282a"
What am I missing if we refer to the documentation?