aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2020-03-05 11:45:21 +0000
committerFabian Kosmale <fabian.kosmale@qt.io>2020-04-30 10:40:07 +0200
commita2eef6b511988b2435c4e39b6b5551e857ce7775 (patch)
tree5d3e3ab84d0377f28a20728f61c340d394e7a5c3 /src/qml/types
parentc8bba05dc54231dbc5dc859f125d64b640e25a41 (diff)
Make Connections object qmlWarning follow a logging category
Connections{} emits a warning if an old syntax is used. Unfortunately that syntax is not available in Qt5.12. Downstream needs to support both at once, which means we have code constantly hitting this warning. We can't even #ifdef the QML code. By introducing a logging category we can still have the warning but provides some option for downstream to temporarily disable through an existing mechanism until older Qt is not supported. Task-number: QDS-2007 Change-Id: Idd34c18ae3e8b3e53c430fab8229bb9812370d0e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qqmlconnections.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index 4c44bba43e..29ed62cd39 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -47,6 +47,7 @@
#include <private/qqmlvmemetaobject_p.h>
#include <qqmlinfo.h>
+#include <QtCore/qloggingcategory.h>
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
@@ -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(<arguments>) { ... }");
+ if (lcQmlConnections().isWarningEnabled()) {
+ qmlWarning(this) << tr("Implicitly defined onFoo properties in Connections are deprecated. "
+ "Use this syntax instead: function onFoo(<arguments>) { ... }");
+ }
#endif
connectSignalsToBindings();
}