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
Forum Updated to NodeBB v4.3 + New Features

Calling functions with typedef arguments in qml

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.3k 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.
  • C Offline
    C Offline
    chezgi
    wrote on 1 Mar 2014, 07:14 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 1 Mar 2014, 21:41 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 2 Mar 2014, 04:41 last edited by
        #3

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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 2 Mar 2014, 10:11 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

          1/4

          1 Mar 2014, 07:14

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved