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

Calling Q_INVOKABLE functions that return QSize, QPoint etc returns inaccessible QVariant(QSize) objects

    XMLWordPrintable

Details

    Description

      If I have a Q_INVOKABLE QSize foo() method, and add the object as a context property, QML does not seem to allow to return foo().width, foo.width() nor foo.width.

      Calling console.log(foo()) returns "QVariant(QSize)" but there seems to be no way to access its properties. However, using Q_PROPERTY(QSize foo READ foo) works and I get the value as expected, with foo.width.

      Calling console.log(foo) when it is a property returns [object Object], suggesting that some additional processing is done for Q_PROPERTYs.

      As the documentation claims that support for QSize/QPoint etc should be in place, this should work from both declared properties and invokable functions.

      Attachments

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

        Activity

          People

            aakenned Aaron Kennedy
            holmsted Lasse Holmstedt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes