QML different style using QGuiApplication and QCoreApplication
Solved
QML and Qt Quick
-
When i using QML in QCoreApplication all widgets have poor style:
Slider in QGuiApplication:
In QCoreApplication:
Button in QGuiApp:
Button in QCoreApp:
Is there a way to resolve this problem?
-
With QApplication from QtWidgets you get a QStyle-based "Desktop" style. With QGuiApplication from QtGui, it is not possible to use QtWidgets so you get a QML-based "Base" style instead. You can specify
QT_QUICK_CONTROLS_STYLE
environment variable if you want to choose a specific style. Make sure to do it before loading any QML.QT_QUICK_CONTROLS_STYLE=Base ./app
or in code:
int main(...) { qputenv("QT_QUICK_CONTROLS_STYLE", "Base"); ... }