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

Moc compiler can't parse Q_INVOKABLE declaration

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: 4.7.3
    • Fix Version/s: 4.8.0
    • Component/s: Build tools: moc
    • Labels:
      None
    • Environment:
      macos 10.5 ( built from source or with official offline distrib )
    • Commits:
      f57dac1faf4d39eae851d0e9238a8b5968b48a73

      Description

      I have used Qt 4.7.3

      // a.h
      
      class A : public QObject
      {
        Q_OBJECT
      
        public:
          Q_PROPERTY( int invokableValue READ invokableValue )
      
          Q_INVOKABLE int invokableValue() { return 0; }
      };
      
      // a_moc.cpp:
      
          if (_c == QMetaObject::InvokeMetaMethod) {
              // no calls here
          }
      #ifndef QT_NO_PROPERTIES
          else if (_c == QMetaObject::ReadProperty) {
              void *_v = _a[0];
              switch (_id) {
              case 0: *reinterpret_cast< int*>(_v) = invokableValue(); break;
          }
      

      The problem can be solved by adding semicolon after Q_PROPERTY ( see http://stackoverflow.com/questions/7846238/q-property-methods-cant-be-called-using-qmetaobjectinvokemethod ).

        Attachments

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

          Activity

            People

            Assignee:
            ogoffart Olivier Goffart (Woboq GmbH)
            Reporter:
            anberlin Iakov Minochkin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes