QmlPuppet: Force QApplication use in puppet if charts is imported

Qt Charts requires QApplication, so force that on when QtCharts import
is detected.

Change-Id: Ie725cb0714f2816a34374e46de71b82f00ce6239
Fixes: QDS-2842
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-09-29 16:52:07 +03:00
parent b099c2967b
commit a3e92da8b8
2 changed files with 6 additions and 1 deletions

View File

@@ -149,7 +149,9 @@ int main(int argc, char *argv[])
#endif #endif
//If a style different from Desktop is set we have to use QGuiApplication //If a style different from Desktop is set we have to use QGuiApplication
bool useGuiApplication = qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE") bool useGuiApplication = (!qEnvironmentVariableIsSet("QMLDESIGNER_FORCE_QAPPLICATION")
|| qgetenv("QMLDESIGNER_FORCE_QAPPLICATION") != "true")
&& qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE")
&& qgetenv("QT_QUICK_CONTROLS_STYLE") != "Desktop"; && qgetenv("QT_QUICK_CONTROLS_STYLE") != "Desktop";
if (useGuiApplication) { if (useGuiApplication) {

View File

@@ -499,6 +499,9 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
QmlDesigner::Import import = QmlDesigner::Import::createLibraryImport("QtQuick3D", "1.0"); QmlDesigner::Import import = QmlDesigner::Import::createLibraryImport("QtQuick3D", "1.0");
if (m_model->hasImport(import, true, true)) if (m_model->hasImport(import, true, true))
environment.set("QMLDESIGNER_QUICK3D_MODE", "true"); environment.set("QMLDESIGNER_QUICK3D_MODE", "true");
import = QmlDesigner::Import::createLibraryImport("QtCharts", "2.0");
if (m_model->hasImport(import, true, true))
environment.set("QMLDESIGNER_FORCE_QAPPLICATION", "true");
#endif #endif
QStringList importPaths = m_model->importPaths(); QStringList importPaths = m_model->importPaths();