forked from qt-creator/qt-creator
Qt Quick Control Application: Optional QtWidget dependency
Let the user chose whether "native styling" via QWidgets/QApplication should be enabled or not. Change-Id: I5eaa7b3a94d5361e62ebce61ff6b7b9216e15b80 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
|
@if %{UseQApplication}
|
||||||
QT += qml quick widgets
|
QT += qml quick widgets
|
||||||
|
@else
|
||||||
|
QT += qml quick
|
||||||
|
@endif
|
||||||
|
|
||||||
SOURCES += %{MainCppFileName}
|
SOURCES += %{MainCppFileName}
|
||||||
|
|
||||||
|
@@ -1,8 +1,12 @@
|
|||||||
%{Cpp:LicenseTemplate}\
|
%{Cpp:LicenseTemplate}\
|
||||||
%{JS: QtSupport.qtIncludes([], ["QWidgets/QApplication", "QQml/QQmlApplicationEngine"])}
|
%{JS: QtSupport.qtIncludes([], [%{UseQApplication} ? "QWidgets/QApplication" : "QtGui/QGuiApplication", "QQml/QQmlApplicationEngine"])}
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@if %{UseQApplication}
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
@else
|
||||||
|
QGuiApplication app(argc, argv);
|
||||||
|
@endif
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||||
|
@@ -84,6 +84,17 @@
|
|||||||
"uncheckedValue": false,
|
"uncheckedValue": false,
|
||||||
"checked": true
|
"checked": true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "UseQApplication",
|
||||||
|
"trDisplayName": "Enable native styling. Requires dependency on the QtWidgets module.",
|
||||||
|
"type": "CheckBox",
|
||||||
|
"data":
|
||||||
|
{
|
||||||
|
"checkedValue": true,
|
||||||
|
"uncheckedValue": false,
|
||||||
|
"checked": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user