Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Calling functions with typedef arguments in qml

Calling functions with typedef arguments in qml

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.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.
  • C Offline
    C Offline
    chezgi
    wrote on last edited by
    #1

    what is the difference between this two functions when calling from qml:

    typedef QVariantMap NewType;
    Q_INVOKABLE QVariantMap testFunc();
    Q_INVOKABLE NewType testFunc();

    calling first function works but calling second function gives error.
    how can i tell to qml engine that NewType is same as QVariantMap?

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

      Hi and welcome to devnet,

      You need to register your new types to make them known to Qt and QML

      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
      • C Offline
        C Offline
        chezgi
        wrote on last edited by
        #3

        thanks SGaist,
        we can only register QObject derived types.
        this type is QVariantMap.

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

          Indeed, sorry I didn't state it explicitly, you have more information about the procedure "here":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-definetypes.html

          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