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. [QML][Link C++ code with QML view] Link for the best practice
Forum Updated to NodeBB v4.3 + New Features

[QML][Link C++ code with QML view] Link for the best practice

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 4 Posters 401 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
    Shadow.01
    wrote on last edited by
    #1

    Dear users,
    as in the title I am developing a test application with a simple QML view and some C++ code. I found in the forum and tutorial several ways to connect a C++ class file with the QML view; but I am interested to the best practice to do it.

    Could you please indicate me a link in which I can find an example with the most correct way to do it?

    Thank you very much!

    KroMignonK 1 Reply Last reply
    1
    • S Shadow.01

      Dear users,
      as in the title I am developing a test application with a simple QML view and some C++ code. I found in the forum and tutorial several ways to connect a C++ class file with the QML view; but I am interested to the best practice to do it.

      Could you please indicate me a link in which I can find an example with the most correct way to do it?

      Thank you very much!

      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by
      #2

      @Shadow-01 said in [QML][Link C++ code with QML view] Link for the best practice:

      Could you please indicate me a link in which I can find an example with the most correct way to do it?

      You could start with QML documentation:

      • https://doc.qt.io/qt-5/qtqml-cppintegration-overview.html
      • especially https://doc.qt.io/qt-5/qtqml-cppintegration-exposecppattributes.html
      • or QML Book => https://qmlbook.github.io/ch17-qtcpp/qtcpp.html#models-in-c

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      1 Reply Last reply
      3
      • S Offline
        S Offline
        Shadow.01
        wrote on last edited by
        #3

        Thank you very much, I will try immediately!

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          A practical example for models using custom classes: https://wiki.qt.io/How_to_Use_a_Custom_Class_in_C%2B%2B_Model_and_QML_View

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          2
          • KH-219DesignK Offline
            KH-219DesignK Offline
            KH-219Design
            wrote on last edited by
            #5

            You can also find some recent discussion of Q_PROPERTY and Q_INVOKABLE , together with links to Qt sample projects (both official samples and unofficial) on: this other recent forum thread.

            www.219design.com
            Software | Electrical | Mechanical | Product Design

            1 Reply Last reply
            1

            • Login

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