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

Bindable-only properties of type qreal/double don't work from QML

    XMLWordPrintable

Details

    • All

    Description

      When providing properties with only the BINDABLE keyword, QML silently ignores them.

      I try to pass the following properties to a QML Rectangle:

          Q_PROPERTY(qreal x BINDABLE getBindableX FINAL)
          Q_PROPERTY(qreal y BINDABLE getBindableY FINAL)
          Q_PROPERTY(qreal z BINDABLE getBindableZ FINAL)
          Q_PROPERTY(qreal width BINDABLE getBindableWidth FINAL)
          Q_PROPERTY(qreal height BINDABLE getBindableHeight FINAL)
          Q_PROPERTY(bool bVisible BINDABLE getBindableVisible FINAL) 

      Members are

          QProperty<qreal> m_X;
          QProperty<qreal> m_Y;
          QProperty<qreal> m_Z;
          QProperty<qreal> m_Width;
          QProperty<qreal> m_Height;
          QProperty<bool> m_bVisible; 

      Getters are like this:

      QBindable<qreal> PropertyClass::getBindableX() const
      {
          return &m_X;
      } 

      Only the bool works, the qreal ones don't (I also tried double, but no change).

      Full sample attached. The sample should show a blinking red rectangle that slowly moves around.

      Attachments

        Issue Links

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

          Activity

            People

              hatemelkharashy Hatem ElKharashy
              asperamanca Robert Schimkowitsch
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes