summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-10-20 12:11:33 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-20 00:01:11 +0000
commiteb8d0d0c9dfcdb57e8883c738d3e07c5489696b6 (patch)
tree9c1f74b4c7de63dd59b0299a814dd6935e3db543
parenta2c57977f382d10ec940f0547a387dd9acf44074 (diff)
Qt Designer: Fix code preview not working in PySide6 on Windows6.6
PySide6 installations do not have a proper Qt directory structure on Windows; so, uic is not found via libexec. Use the path of the application instead, which should work in all cases. Fixes error Unable to launch ...\Lib\site-packages\PySide6\bin\uic: Process failed to start: The system cannot find the file specified. Change-Id: I841836a89962f4db962816453b9e99f33ffaf86b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> (cherry picked from commit c9b04d4597713a9751b268f30744b4c3cac4ad58) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 7c85c38bb8c392f228f5c3f87cba6b8ba729274d)
-rw-r--r--src/designer/src/lib/shared/qdesigner_utils.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp
index dfd887f91..18668c4a2 100644
--- a/src/designer/src/lib/shared/qdesigner_utils.cpp
+++ b/src/designer/src/lib/shared/qdesigner_utils.cpp
@@ -13,7 +13,10 @@
#include <QtDesigner/taskmenu.h>
#include <QtDesigner/qextensionmanager.h>
+#include <QtCore/qcoreapplication.h>
#include <QtCore/qdir.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qoperatingsystemversion.h>
#include <QtCore/qprocess.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qdebug.h>
@@ -713,7 +716,20 @@ namespace qdesigner_internal
{
QProcess uic;
QStringList arguments;
- QString binary = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath) + "/uic"_L1;
+ static constexpr auto uicBinary =
+ QOperatingSystemVersion::currentType() != QOperatingSystemVersion::Windows
+ ? "/uic"_L1 : "/uic.exe"_L1;
+ QString binary = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath) + uicBinary;
+ // In a PySide6 installation, there is no libexec directory; uic.exe is
+ // in the main wheel directory next to designer.exe.
+ if (!QFileInfo::exists(binary))
+ binary = QCoreApplication::applicationDirPath() + uicBinary;
+ if (!QFileInfo::exists(binary)) {
+ errorMessage = QApplication::translate("Designer", "%1 does not exist.").
+ arg(QDir::toNativeSeparators(binary));
+ return false;
+ }
+
switch (language) {
case UicLanguage::Cpp:
break;