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. About integrating c++ and qml
Forum Updated to NodeBB v4.3 + New Features

About integrating c++ and qml

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

    Hello ,
    I would like to ask when should I use the qml register type and when to use the plugin.
    Actually the concept is new to me and I feel confused and I don’t know from where to start.
    I watched the video of Qt developer days 2011 It is discussing this task it clarified a little bit some concepts but I still find it ambiguous .
    Thanks in advance.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Duff
      wrote on last edited by
      #2

      It looks like plugins are useful when you want to package a QML component or collection of components for the purpose of using them in different projects or making them available to other developers. I used register type in my main c++ program just to make a c++ class accessible from my QML code ...

      qmlRegisterType<WorkerThread>("com.myapp.myclass", 1, 0, "MyApi");

      and then import it in my qml file ...

      import com.myapp.myclass 1.0

      --Duff

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        ysing
        wrote on last edited by
        #3

        thanks Duff but I find this concept very difficult .

        1 Reply Last reply
        0
        • D Offline
          D Offline
          Duff
          wrote on last edited by
          #4

          Check out this page in the documentation. This is how I figured out how to integrate my c++ class ...

          http://qt-project.org/doc/qt-5/qtqml-cppintegration-topic.html

          --Duff

          1 Reply Last reply
          0
          • Y Offline
            Y Offline
            ysing
            wrote on last edited by
            #5

            Thanks Duff, sometimes in the tutorials they say extending qml from c++ and sometimes they say extending c++ from qml do you know what are the differences.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Duff
              wrote on last edited by
              #6

              Well, it goes both ways. You can access c++ classes from QML and access QML objects from C++. Just depends on what you are trying to accomplish.

              --Duff

              1 Reply Last reply
              0
              • Y Offline
                Y Offline
                ysing
                wrote on last edited by
                #7

                ok , what about the wrapper object when should I use it and what does it d exactly?

                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