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

Argument name missing in auto-generated signals of Q_PROPERTY

    XMLWordPrintable

Details

    Description

      When “Generate signals with …” is enabled ( see QtCreatorbug26184-setting.png )
      and right click -> Refactor -> Generate missing Q_PROPERTY member of the following code

      Q_PROPERTY(QString name READ name WRITE setname NOTIFY nameChanged)
      

      QtCreator auto-generates

      signals:
          void nameChanged(const QString &);
      

      This doesn't work if QML slot is like this.

      onNameChanged: console.log(name)
      

      and this message is output
      qrc:/main.qml:17: ReferenceError: name is not defined

      If the slot is like this, it works.

              onNameChanged : function(name)
                  {
                    console.log("Name changed to", name);
                  }
      

      But if auto-generated code is like this (add “name” as argument name)

      signals:
          void nameChanged(const QString &name);
      

      both methods work without a problem.

      It'd be nice to have the argument name if this is not intentional.

      Attachments

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

        Activity

          People

            artem.sokolovskii Artem Sokolovskii
            nagrohn Nahomi Gröhn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes