Standard colors in QtCreator (KDE)
-
It changes the system palette application wide, so the following will give you an orange rectangle:
Rectangle { SystemPalette { id: systemPalette } anchors.fill: parent color: systemPalette.button }
-
@Rouleaux
I think there are some misunderstanding, it will be better if you post your code here so would be able to get that point on which this thread start and try to resolve too soon. -
@Vicky-Sharma Yes, sorry, that might clear things up.
import QtQuick 2.7 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Button { id: button1 x: 8 y: 8 text: qsTr("Nicotine Base") } }
This is my QML. I'd like to know wether there is an option to provide the systemtheme (mine for example is BreezeDark), but then applicationwide. Now I have to apply
SystemPalette
to every single element, but I suppose there must be an easier way right? -
Ok, so for natively looking widgets you'll need
QT += widgets
in your *.pro fileQApplication
in main.cpp (notQGuiApplication
)- QtQuick.Controls 1 (not 2)
E.g.:
main.cpp
#include <QApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QApplication app(argc, argv); QQmlApplicationEngine engine(QUrl(QLatin1String("qrc:/main.qml"))); return app.exec(); }
main.qml
import QtQuick 2.7 import QtQuick.Controls 1.4 ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") Button { text: "Exit" anchors.centerIn: parent onClicked: Qt.quit() } }
-
@Wieland Shoot, I've just started using QtQuick.Controls 2.0..
-
@Rouleaux
unfortunately i don't have 5.7 but i checked on 5.6 and rewrite few thing, you may check too as well as "Wieland" is also post write one check and revert if any error.
import QtQuick 2.5
import QtQuick.Window 2.2
import QtQuick.Controls 1.4Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")Button { id: button1 x: 8 y: 8 text: qsTr("Nicotine Base") }
}