Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116576

[REG 6.2 → 6.4]: Connections and signals whose names start with an underscore

    XMLWordPrintable

Details

    • All
    • 2fc19f2c6 (dev), 29b580340 (6.6), 69db4d51a (6.5)

    Description

      Prior to Qt 6.4, a signal whose name starts with an underscore could be connected via a Connections object to a function starting with "on" and ending with the name of the signal. As of Qt 6.4, the first character after the underscore must be uppercased. This is a runtime compatibility breakage; the function that was previously called, is no longer, and there is no warning printed/log output.

      The convention is that the first character in the signal name is uppercased in on<Signal> handlers. There is no special rule for underscore, which is the same in uppercase and lowercase.

      Consider the below inlined example; the on_foo() function is no longer called.

      import QtQuick
      
      Item {
          id: root
          width: 100
          height: 100
          signal _foo
      
          Connections {
              target: root
              function on_Foo() {
                  console.info("Emitted for both Qt 6.2 and 6.4!");
              }
              function on_foo() { // <== Notice that the underscore is itself in uppercase
                  console.info("Only emitted for Qt 6.2");
              }
          }
      
          Timer {
              interval: 100
              onTriggered: root._foo();
              running: true
          }
      }
      
      

      Attachments

        For Gerrit Dashboard: QTBUG-116576
        # Subject Branch Project Status CR V

        Activity

          People

            ulherman Ulf Hermann
            andrhans Andreas Aardal Hanssen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes