Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-12214

Wrong default name for changed signal handlers when property starts with underscore

    XMLWordPrintable

Details

    • Ie8009846ce27d4acbc3e9ad4dd7dda73fde39413

    Description

      When I add a property whose name starts with an underscore (e.g. _foo) to a QML file and try to add a signal handler for its changed signal, then the signal handler name suggested by Qt Creator's code completer has the wrong capitalization. In this case it would suggested "onfooChanged" whereas the correct name is "on_FooChanged".

      The following file gives no errors in the editor in Qt Creator:

      import QtQuick 2.2
      import QtQuick.Window 2.1
      
      Window {
          visible: true
          width: 360
          height: 360
      
          property real __foo: 0.0
          on__fooChanged: console.debug("test")
      
      }
      

      However, when run it will give the following error: Cannot assign to non-existent property "on__fooChanged"

      The following code runs fine with QML:

      import QtQuick 2.2
      import QtQuick.Window 2.1
      
      Window {
          visible: true
          width: 360
          height: 360
      
          property real __foo: 0.0
          on__FooChanged: console.debug("test")
      
      }
      

      But in Qt Creator it gives a red underline for "on__FooChanged" with the error "Invalid property name (M16)".

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            fawzi Fawzi Mohamed
            esabraha Eskil Abrahamsen Blomfeldt
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes