From 247b9999cd389ae5b11a21b535b1c9ff817dc9c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 11 Aug 2015 16:19:24 +0200 Subject: [PATCH] macdeployqt: Workaround for QtQuick.PrivateWidgets Deploy PrivateWidgets if QtWidget.framework and QtQuick.Controls is in use. Task-number: QTBUG-45977 Change-Id: Id2d7af8895be136d84bed92043fc790b156d8dea Reviewed-by: Gabriel de Dietrich --- src/macdeployqt/shared/shared.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index b85fa0d..d6dcfb6 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -1108,6 +1108,8 @@ void deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf return; } + bool qtQuickContolsInUse = false; // condition for QtQuick.PrivateWidgets below + // deploy each import foreach (const QJsonValue &importValue, doc.array()) { if (!importValue.isObject()) @@ -1118,6 +1120,9 @@ void deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf QString path = import["path"].toString(); QString type = import["type"].toString(); + if (import["name"] == "QtQuick.Controls") + qtQuickContolsInUse = true; + LogNormal() << "Deploying QML import" << name; // Skip imports with missing info - path will be empty if the import is not found. @@ -1147,6 +1152,21 @@ void deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf deployQmlImport(appBundlePath, deploymentInfo.rpathsUsed, path, name); LogNormal() << ""; } + + // Special case: + // Use of QtQuick.PrivateWidgets is not discoverable at deploy-time. + // Recreate the run-time logic here as best as we can - deploy it iff + // 1) QtWidgets.framework is used + // 2) QtQuick.Controls is used + // The intended failure mode is that libwidgetsplugin.dylib will be present + // in the app bundle but not used at run-time. + if (deploymentInfo.deployedFrameworks.contains("QtWidgets.framework") && qtQuickContolsInUse) { + LogNormal() << "Deploying QML import QtQuick.PrivateWidgets"; + QString name = "QtQuick/PrivateWidgets"; + QString path = qmlImportsPath + QLatin1Char('/') + name; + deployQmlImport(appBundlePath, deploymentInfo.rpathsUsed, path, name); + LogNormal() << ""; + } } void changeQtFrameworks(const QList frameworks, const QStringList &binaryPaths, const QString &absoluteQtPath) -- 2.7.4