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

Auto Implemented Q_PROPERTY (not a refactoring)

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.3.2
    • Build tools: moc
    • None

    Description

      I know there is a refactoring that auto creates the needed members, signals and methods for a Q_PROPERTY but I was wondering if it wouldn't be possible to just have an AUTO attribute on the Q_PROPERTY itself for the trivial cases. Something like
      Q_PROPERTY (propName READ WRITE AUTO)
      If READ and WRITE are both there both a getter and setter would be created. If just READ then just a getter and I suppose if just WRITE then just a setter/signal.

      The methods, members, signals etc would all work just like the refactoring but the code would be "hidden". I can envision something similar to how the Qt Widgets UI code is done. The user can't modify that code because it can be regenerated at any time. If the user later realizes they want to control the implementation details they just remove AUTO and use an existing form of Q_PROPERTY and refactor the methods into existence. It would make view manager classes for QML much cleaner. It shouldn't impose any burden on maintainers since it will be documented what the AUTO keyword does.

      Attachments

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

        Activity

          People

            ogoffart Olivier Goffart (Woboq GmbH)
            rolias Tod Gentille
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes