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

QML metatype: A* is not "compatible" with const A*

XMLWordPrintable

      I have some QObject-derived class Foo.

      I register it using: qmlRegisterType<Foo>();

      I have 2 classes exported to QML: one has this method:

      Q_INVOKABLE Foo* createFoo();

      Second one has this method:

      Q_INVOKABLE void useFoo(const Foo*)

      The code in QML:

      var foo = firstClass.createFoo();

      secondClass.useFoo(foo);

      The last line of code generates exception that the parameter is unknown.

      WORKAROUND: I had to remove const specifier from the useFoo parameter.

       

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

            shausman Simon Hausmann
            alervd Alexander Dyagilev
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes