Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Disable/Hide/Remove 'QML Connections' runtime warning



  • Hi everybody,

    Since the recent upgrade to Qt 5.15 I now get numerous runtime warnings for some QML code I'm maintaining:

    QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
    

    I understand that in Qt 5.15 one can switch to a new syntax here to get rid of this warning, but I can't do that as the code needs to be compatible with some older versions as well. This warning is, however, polluting the output on the command line, which is simply unacceptable (at least in my use case, though I'm sure I'm not alone with this opinion).

    Is there any way to remove/hide/disable this warning?
    Any help would be greatly appreciated!

    Thanks,
    aran

    Edit:
    Here's a very simple example illustrating this dilemma:

    import QtQuick 2.0
    
    Rectangle {
        id: page
        width: 300; height: 200
        color: "red"
        MouseArea {
            id: m
            anchors.fill: parent
        }
        Connections {
            target: m
            onClicked: 
                console.log("old syntax")
        }
        Connections {
            target: m
            function onClicked(mouse) {
                console.log("new syntax")
            }
        }
    }
    

    When run the above code (e.g., with qmlscene) under Qt 5.15, I get the above mentioned warning, and a click returns both log messages. When run on a system with an older Qt version I don't get any warning and a click only returns "old syntax".



  • Oh, nevermind, should have done a better job searching this forum, it already was answered here before:

    In Qt 5.15.1 there will be a way to disable this, see here: https://codereview.qt-project.org/c/qt/qtdeclarative/+/293011



  • Oh, nevermind, should have done a better job searching this forum, it already was answered here before:

    In Qt 5.15.1 there will be a way to disable this, see here: https://codereview.qt-project.org/c/qt/qtdeclarative/+/293011


Log in to reply