aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/plugins/designer/designercustomwidgets.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-02-08 09:05:57 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-02-09 12:34:40 +0100
commit2379fbd9f10255bba9ad3caaa8ccea17fc9cdfbf (patch)
tree9b0fe8f90f24160a2a6cc197db6597a67756f761 /sources/pyside6/plugins/designer/designercustomwidgets.cpp
parentb7d4f311e9316bb264f2bf29286037d47d56a91a (diff)
Qt Designer plugin: Fix running from within QUiLoader
Prevent re-initialization of Python. Fixes: PYSIDE-2222 Pick-to: 6.4 Change-Id: I50d813479598aa160ed163eb4de50bb9e34b6f99 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/plugins/designer/designercustomwidgets.cpp')
-rw-r--r--sources/pyside6/plugins/designer/designercustomwidgets.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/sources/pyside6/plugins/designer/designercustomwidgets.cpp b/sources/pyside6/plugins/designer/designercustomwidgets.cpp
index c62f8b6fc..5988dff4e 100644
--- a/sources/pyside6/plugins/designer/designercustomwidgets.cpp
+++ b/sources/pyside6/plugins/designer/designercustomwidgets.cpp
@@ -224,7 +224,9 @@ PyDesignerCustomWidgets::PyDesignerCustomWidgets(QObject *parent) : QObject(pare
qputenv(pythonPathVar, value);
}
- initPython();
+ // Might be initialized already, for example, when loaded from QUiLoader.
+ if (Py_IsInitialized() == 0)
+ initPython();
// Run all register*py files
QString errorMessage;