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

moc doesn't set hasStdCppSet() for readonly properties

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.6.1
    • Build tools: moc
    • None

    Description

      So I've just learned about QMetaProperty's obscure hasStdCppSet() attribute. After some experiments I realized that this attribute simply it is not set for some properties that definitely have C++ getters in their Q_PROPERTY() declaration. Worried I'd use Qt properties inefficently for years I've looked at the code and found this:

      bool stdCppSet() const {
          if (name.isEmpty())
              return false;
          QByteArray s("set");
          s += QtMiscUtils::toAsciiUpper(name[0]);
          s += name.mid(1);
          return (s == write);
      }
      

      So apparently this attribute only gets set when moc finds a C++ setter with proper name. Properties with proper C++ getter are ignored. Is this the intended and reasonable behavior? Should this attribute also be set for readonly properties with C++ getter? Should this behavior stay as it is for compability with the myriad of tools outside maybe depending on the current behavior? If the behavior shall remain as it is, this obscure behavior should be documented at least.

      Attachments

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

        Activity

          People

            fabiankosmale Fabian Kosmale
            hasselmm Mathias Hasselmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes