0

I need your help.

There is a class in C++, in which is implemented relatively difficult algorithms. And I also added to it a graphical interface for QML. I registered the class:

qmlRegisterType<Solver>("xyz.lstu", 1, 0, "Solver");

I launch it as:

onClicked: {
    solver.start()
}

When I run the methods of the class, the GUI stops responding and starts responding only after the function is completed. The class object regularly sends it signals about progress and I want to immediately bring them to the GUI. How to run these methods on a separate thread? In Java, I solved such things like this

SwingUtilities.invokeLater(..) 
6
  • 1
    If you want us to help you, you must provide a Minimal, Complete, and Verifiable example Commented Oct 30, 2017 at 18:36
  • Do you run everything in the same thread? Commented Oct 30, 2017 at 18:48
  • Yes. The question is how to divide Commented Oct 30, 2017 at 18:57
  • 1
    Not only you did not provide enough of MCVP (do it next time) but you just need to learn multithreading and ways to accomplish starting the task on a worker thread in Qt. There a number of answers like that. I would create special worker object on (not the one that talks to UI, it has to be on UI thread) and do moveToThread for it and then use invokeMethod to dispatch a call on worker thread from UI. Like that: stackoverflow.com/questions/13948337/… But of course there is many ways to do so. Commented Oct 30, 2017 at 19:02
  • 1
    I voted to close the question as a duplicate of many similar ones. If this one question had specifics preventing the author from doing the task then it would make sense to answer. But the author has just to learn multithreading/ Qt and helping him with the answer would be more of education rather than practical advise. Commented Oct 30, 2017 at 19:07

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.