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
Qt 6.11 is out! See what's new in the release blog

About integrating c++ and qml

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 2 Posters 2.4k 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.
  • ? Offline
    ? Offline
    A Former User
    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
    • ? Offline
      ? Offline
      A Former User
      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

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        thanks Duff but I find this concept very difficult .

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          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

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            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
            • ? Offline
              ? Offline
              A Former User
              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.

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                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