Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved Disable/Hide/Remove 'QML Connections' runtime warning

    QML and Qt Quick
    2
    3
    805
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aran last edited by aran

      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".

      1 Reply Last reply Reply Quote 0
      • A
        aran last edited by aran

        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

        Aleksey_K 1 Reply Last reply Reply Quote 0
        • A
          aran last edited by aran

          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

          Aleksey_K 1 Reply Last reply Reply Quote 0
          • Aleksey_K
            Aleksey_K @aran last edited by

            @aran said in Disable/Hide/Remove 'QML Connections' runtime warning:

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

            Where is the link where it was answered? How to disable only 1 category?

            1 Reply Last reply Reply Quote 0
            • First post
              Last post