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. [SOLVED] Problems with setting properties in Qt 5.4

[SOLVED] Problems with setting properties in Qt 5.4

Scheduled Pinned Locked Moved General and Desktop
propertyqobject
7 Posts 2 Posters 2.2k Views
  • 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.
  • T Offline
    T Offline
    ttuna
    wrote on last edited by ttuna
    #1

    I have defined a property similar to this:
    Q_PROPERTY(QList<QString> string_list READ stringList WRITE setStringList NOTIFY stringListChanged)

    I want to use bool QObject::setProperty(const char * name, const QVariant & value) to set this property, but the function returns false ... with Qt 5.4.

    I have compiled the same program with Qt 5.5 and - voila - it works.

    Any ideas if there was a bugfix (- haven't found anything in the sources) or why this happens?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      ttuna
      wrote on last edited by
      #2

      just a push

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Didn't you have any error message at run time ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        T 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Didn't you have any error message at run time ?

          T Offline
          T Offline
          ttuna
          wrote on last edited by
          #4

          @SGaist No, there are no errors at runtime. Just that setProperty() returns false.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Do you also have that failure if you use QStringList rather than QList<QString> ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • T Offline
              T Offline
              ttuna
              wrote on last edited by
              #6

              @SGaist
              Weird! After changing QList<String> to QStringList the problem didn't show up again. Thx for the hint ...
              Nevertheless the QList behaviour is strange.

              BTW I've tested these with Qt 5.4.2 (MSVC2013 OpenGL 32bit) and Qt 5.5.1 (MSVC2013 OpenGL 32bit)

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                They are two different types so there might have been something going because of that

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                • Login

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