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. Right Way of Updating a QML File from C++
Forum Updated to NodeBB v4.3 + New Features

Right Way of Updating a QML File from C++

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

    I just started learning QML. I have the following files in my application:

    • main.cpp
    • connection_handler.h/cpp
    • main.qml
    • MainForm.ui.qml

    I am launching the qml file from main.cpp using
    @ QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    QObject *root = engine.rootObjects().first();@
    

    The connection_handler class just initiates a TCP connection and updates the UI regarding the status. Currently, I am using signals and slots for the UI update. I am connecting the signals and slots from main.cpp.

    For updating the UI, am I doing this the right way or would you recommend better ways to accomplish this?

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      bq. Currently, I am using signals and slots for the UI update. I am connecting the signals and slots from main.cpp.

      Yes that is also a right way. For other approaches you can check "this":http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html doc.

      157

      1 Reply Last reply
      0
      • U Offline
        U Offline
        unni
        wrote on last edited by
        #3

        [quote author="p3c0" date="1421902957"]
        Yes that is also a right way. For other approaches you can check "this":http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html doc.[/quote]

        Thanks very much.

        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