diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-08-03 08:46:43 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-08-03 10:21:13 +0000 |
commit | d09cafe27130992c491c89cd131c4e021d69b8a3 (patch) | |
tree | 3c6bcf785123eb24679f6c21472bbd9325153674 | |
parent | 716b9c6435ee5de5de2cc229551624201807f3f6 (diff) |
PySide6 Qt Designer plugin: Silence warnings when used from QUiLoader
Only output warnings when run from Qt Designer as determined
by the application name.
Change-Id: I870ca75242bf70bdf53c51fdeb0f70067455e268
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
(cherry picked from commit 28a02f64b1cbe044809ce4a11df8a90f766f5117)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/pyside6/plugins/designer/designercustomwidgets.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sources/pyside6/plugins/designer/designercustomwidgets.cpp b/sources/pyside6/plugins/designer/designercustomwidgets.cpp index 5988dff4e..832a14e18 100644 --- a/sources/pyside6/plugins/designer/designercustomwidgets.cpp +++ b/sources/pyside6/plugins/designer/designercustomwidgets.cpp @@ -175,13 +175,20 @@ static void initPython() qAddPostRoutine(Py_Finalize); } +static bool withinQtDesigner = false; + PyDesignerCustomWidgets::PyDesignerCustomWidgets(QObject *parent) : QObject(parent) { qCDebug(lcPySidePlugin, "%s", __FUNCTION__); + withinQtDesigner = QCoreApplication::applicationName() == u"Designer" + && QCoreApplication::organizationName() == u"QtProject"; + if (!qEnvironmentVariableIsSet(pathVar)) { - qCWarning(lcPySidePlugin, "Environment variable %s is not set, bailing out.", - pathVar); + if (withinQtDesigner) { + qCWarning(lcPySidePlugin, "Environment variable %s is not set, bailing out.", + pathVar); + } return; } @@ -246,6 +253,7 @@ QList<QDesignerCustomWidgetInterface *> PyDesignerCustomWidgets::customWidgets() { if (auto collection = findPyDesignerCustomWidgetCollection()) return collection->customWidgets(); - qCWarning(lcPySidePlugin, "No instance of QPyDesignerCustomWidgetCollection was found."); + if (withinQtDesigner) + qCWarning(lcPySidePlugin, "No instance of QPyDesignerCustomWidgetCollection was found."); return {}; } |