diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-08-03 08:46:43 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-08-03 11:00:44 +0200 |
| commit | 28a02f64b1cbe044809ce4a11df8a90f766f5117 (patch) | |
| tree | b291167067f261f650ad0842b231ed0d88ffef66 /sources/pyside6/plugins/designer/designercustomwidgets.cpp | |
| parent | dad03dc22e660b248bccc18168ed16a423fae67e (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.
Pick-to: 6.5
Change-Id: I870ca75242bf70bdf53c51fdeb0f70067455e268
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Diffstat (limited to 'sources/pyside6/plugins/designer/designercustomwidgets.cpp')
| -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 {}; } |
