Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can QML Viwer be run on a seperate Thread?

Can QML Viwer be run on a seperate Thread?

Scheduled Pinned Locked Moved General and Desktop
3 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.
  • C Offline
    C Offline
    Cg_Artist
    wrote on last edited by
    #1

    As I try and wrap my head around QML and how to use it in my cpp application I had a few questions. In my particular situation I am trying to use QML to build the interface for a plugin that I have developed for another application (Maya). I ran a test using:
    @QDeclarativeView view;
    view.setSource(QUrl("qrc:/myCustomUI.qml"));
    view.show();@
    This resulted in my allowing me to my UI for the duration of time that my function ran. However, as you can imagine this was not my desired result. So I guess my questions are what the best approach would be run a QML interface in a plugin for another application and am I right in thinking that I would have to run the UI on a separate thread from my main application. Anyway I just thought I would ask here first before I dig in to deep, hoping that someone might be able to provide some direction on how to pull this off.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Cg_Artist
      wrote on last edited by
      #2

      To answer part of my own question I some how missed using the "app.exec()" at the end of my function. Now it remains on the screen.

      @QDeclarativeView view;
      view.setSource(QUrl("qrc:/myCustomUI.qml"));
      view.show();
      return app.exec();
      @

      Still looking in the multi-threading aspect. Will post what I discover.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        QDeclarativeView, as every other GUI class, must live in the main thread. There is no way to circumvent this and move it to another thread.

        http://www.catb.org/~esr/faqs/smart-questions.html

        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