Skip to content
QtWS25 Last Chance
  • Issue with Worker Class when used with QTables

    Moved Unsolved Qt for Python qtablemodel workerthread
    20
    0 Votes
    20 Posts
    988 Views
    SGaistS
    You can implement a debouncer. For example, accumulate a certain amount of changes and only then signal that the model has changed to minimize the amount of time the views will query the model. Also, don't forget to properly use lock mechanism to avoid writing to the same object from multiple different threads.
  • 0 Votes
    3 Posts
    1k Views
    jeremy_kJ
    @Tom-asso said in Newbie question: How to spin a BusyIndicator while loading file data?: Just starting out with Qt threading api and have some questions. My C++/QML app reads data from a large file and displays it; the QML-defined GUI lets the user modify the display (e.g. with color maps, view angles, etc), and also provides a menu item to load data from another file. While loading data, I would like a QML BusyIndicator to spin, until the data is ready to display. While the BusyIndicator is spinning, the user should be prevented from trying to modify the display through the GUI. I realize the GUI thread must be running in order to spin the BusyIndicator, so presumably my GUI thread code should at least set the BusyIndicator.running property, and launch a worker thread which actually opens the new file and loads its data. What’s the best way to run a worker thread with Qt’s api? Do you plan to allow cancellation of loading? How do I prevent user interaction with other GUI controls while the worker thread is doing its job? Item has an enabled property that controls mouse and keyboard input for the item and its children. Eg: import QtQuick 2.12 import QtQuick.Window 2.12 Window { contentItem.enabled: false TextInput { anchors.centerIn: parent text: "This input is disabled by its parent" } } @AxelVienna said in Newbie question: How to spin a BusyIndicator while loading file data? QApplication::setOverrideCursor(Qt::WaitCursor); QGuiApplication, not QApplication. There's no need to involve widgets for a QML/Quick application.
  • 0 Votes
    5 Posts
    2k Views
    O
    Hi, You can connect the "finished()" signal to a slot and there check if all threads are not running. I assume that you have a list of threads.
  • 0 Votes
    12 Posts
    2k Views
    L
    Just replying to say I got it working 100% as I expected, while still registering my object as a singleton! I just added a Connections element to my QML code, with the singleton object as its target. Thank you for your help, @mrjj
  • 0 Votes
    8 Posts
    4k Views
    VRoninV
    I agree you need to use a state machine for that case. http://doc.qt.io/qt-5/qstatemachine.html probably helps putting down the skeleton already
  • 0 Votes
    9 Posts
    4k Views
    P
    Got it! Many thanks SGaist!
  • Is my multithreading approach correct?

    Solved General and Desktop multithreads gui workerthread
    2
    1 Votes
    2 Posts
    1k Views
    mrjjM
    Hi Its sounds like the classic worker - processing - display design with the twist of caching signals in processing. In my opinion is a very good design. :)