Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Q_PROPERTY parse err for MEMBER QVariantList but not for other types
Forum Updated to NodeBB v4.3 + New Features

Q_PROPERTY parse err for MEMBER QVariantList but not for other types

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 969 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Szymon. M. Sabat
    wrote on last edited by
    #1
    #include <QWizardPage>
    #include <QVariantList>
    
    namespace Ui {
    class Page4_students;
    }
    
    class Page4_students : public QWizardPage
    {
        Q_OBJECT
    
    public:
        Q_PROPERTY(qint32 test MEMBER m_test NOTIFY testChanged)
        Q_PROPERTY(QVariantList saddrs MEMBER m_saddrs NOFITY saddrsChanged)
        explicit Page4_students(QWidget *parent = nullptr);
        ~Page4_students();
    
    signals:
        void saddrsChanged();
        void testChanged();
    
    private:
        qint32 m_test = 0;
        QVariantList m_saddrs;
        Ui::Page4_students *ui;
    };
    
    #endif // PAGE4_STUDENTS_H
    

    I'm getting Parse error at "m_saddrs" so I've created the test property and the qint32 is working just fime. I see examples of Q_PROPERTY with QVariantList on the internet, why doesn't it work?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Q_PROPERTY is usually placed in private section, but that is probably unrelated to your error.

      Have you tried using QList<QVariant> instead of QVariantList? In some cases it works better.

      (Z(:^

      S 1 Reply Last reply
      0
      • sierdzioS sierdzio

        Q_PROPERTY is usually placed in private section, but that is probably unrelated to your error.

        Have you tried using QList<QVariant> instead of QVariantList? In some cases it works better.

        S Offline
        S Offline
        Szymon. M. Sabat
        wrote on last edited by Szymon. M. Sabat
        #3

        @sierdzio I actually started with QList<QVariant>, also tried just QList in the macro (I've read it's an alias). Anything else I could try? The macro was moved to public in my efforts to try everything, it doesn't work in private either...

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Szymon. M. Sabat
          wrote on last edited by
          #4

          Ok, found it. NOTIFY, not NOFITY. Also, found it thanks to this:
          https://bugreports.qt.io/browse/QTBUG-36367

          sierdzioS 1 Reply Last reply
          3
          • S Szymon. M. Sabat

            Ok, found it. NOTIFY, not NOFITY. Also, found it thanks to this:
            https://bugreports.qt.io/browse/QTBUG-36367

            sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            @Szymon-M-Sabat said in Q_PROPERTY parse err for MEMBER QVariantList but not for other types:

            Ok, found it. NOTIFY, not NOFITY. Also, found it thanks to this:
            https://bugreports.qt.io/browse/QTBUG-36367

            Oh my goodness, of course, a typo. Well, thanks for sharing the solution :-) I'll be extra careful next time I see this error message.

            (Z(:^

            1 Reply Last reply
            3

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved