Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Q_REVISION(x) macro & Q_INVOKABLE in qt5 plugin
Forum Updated to NodeBB v4.3 + New Features

Q_REVISION(x) macro & Q_INVOKABLE in qt5 plugin

Scheduled Pinned Locked Moved C++ Gurus
2 Posts 1 Posters 2.8k Views 1 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
    scubakid
    wrote on last edited by
    #1

    Having problems getting the QML Type Versioning in cpp Plugins to work in QT5, the new Q_REVISION Macro only seems to work for signals (slots haven't tested yet).

    The Documentation does not explicitly say how to use the macro with Q_INVOKABLE's. I see it implemented in code like qdeclarativetextinput_p.h :

    "Q_INVOKABLE Q_REVISION(1) int positionAt(int x, CursorPosition position) const;"

    ..... My Implementation test....

    MyItem Class Header

    public:
    Q_INVOKABLE Q_REVISION(2) QVariant getFunction() const;

    signals:
    Q_REVISION(1) void aSignal();

    qml plugin registerTypes() func

    // Class MyItem Revision 2 is available in V1.1 of module
    qmlRegisterType<MyItem,2>(uri, 1, 1, "MyItem");
    
    // Class MyItem Revision 1 is available in V1.0 of module
    qmlRegisterType<MyItem,1>(uri, 1, 0, "MyItem");
    

    When I import the module v1.0 in QML it contains the Function supposed to be ONLY in Revision 2 (i.e. module v1.1) . This versioning works for the Signal and Properties.

    any bright ideas? have I made a goof or is this a bug?

    cheers.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      scubakid
      wrote on last edited by
      #2

      // Class MyItem Revision 2 is available in V1.1 of module
      qmlRegisterType<MyItem,2>(uri, 1, 1, “MyItem”);

      // Class MyItem Revision 1 is available in V1.0 of module
      qmlRegisterType<MyItem,1>(uri, 1, 0, “MyItem”);

      sorry lost some formating there!

      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