diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp index 4c44bba43e6..29ed62cd399 100644 --- a/src/qml/types/qqmlconnections.cpp +++ b/src/qml/types/qqmlconnections.cpp @@ -47,6 +47,7 @@ #include #include +#include #include #include @@ -54,6 +55,8 @@ QT_BEGIN_NAMESPACE +Q_LOGGING_CATEGORY(lcQmlConnections, "qt.qml.connections") + class QQmlConnectionsPrivate : public QObjectPrivate { public: @@ -276,8 +279,10 @@ void QQmlConnections::connectSignals() connectSignalsToMethods(); } else { #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - qmlWarning(this) << tr("Implicitly defined onFoo properties in Connections are deprecated. " - "Use this syntax instead: function onFoo() { ... }"); + if (lcQmlConnections().isWarningEnabled()) { + qmlWarning(this) << tr("Implicitly defined onFoo properties in Connections are deprecated. " + "Use this syntax instead: function onFoo() { ... }"); + } #endif connectSignalsToBindings(); }