QQuickView change controls palette
-
Hi,
I think you can do this by setting custom QPalette for your Application.
-
@ QGuiApplication app(argc, argv);
QPalette customPalette; customPalette.setColor(QPalette::Window, QColor("red")); customPalette.setColor(QPalette::Background, QColor("red")); customPalette.setColor(QPalette::WindowText, QColor("red")); customPalette.setColor(QPalette::Foreground, QColor("red")); customPalette.setColor(QPalette::Base, QColor("red")); customPalette.setColor(QPalette::AlternateBase, QColor("red")); customPalette.setColor(QPalette::ToolTipBase, QColor("red")); customPalette.setColor(QPalette::ToolTipText, QColor("red")); customPalette.setColor(QPalette::Text, QColor("red")); customPalette.setColor(QPalette::Button, QColor("red")); customPalette.setColor(QPalette::ButtonText, QColor("red")); customPalette.setColor(QPalette::BrightText, QColor("red")); app.setPalette(customPalette);@
Doesn't work (
-
I tried the following which works
@
QPalette customPalette(app.palette());
customPalette.setColor(QPalette::ButtonText, QColor("red"));
customPalette.setColor(QPalette::WindowText,QColor("yellow"));
app.setPalette(customPalette);
@and QML
@
Button {
text: "Qt"
}Label {
text: "Hello world"
}
@Here the color of the text changes as per the palette but neither QPalette::Window/QPalette::Background/QPalette::Base/QPalette::Button worked for background of button for eg.