Important: Please read the Qt Code of Conduct -

Does reparented widgets get drawn when parent is redrawn?

  • Hi to everybody! :)

    I have the following situation: a Manager [QMainWindow] has a Tracker [QWidget] as its centralWidget and it has a layout with several Camera [QWidget and QRunnable] implementing the virtual methods run() and paintEvent().

    The execution should be as follows:

    Manager launches a long-running thread [QtConcurrent::run()] to continuosly update each Camera inside the Tracker

    In each step of this thread, Tracker launches a thread for each Camera [QThreadPool::start()] that prepares the QImage to be shown by every Camera

    Every Camera widget inside Tracker should be updated with the new image previously computed

    Tracker waits for every Camera thread to be finished [QThreadPool::waitForDone()] then restart the update loop

    At every time, Manager should be able to interrupt and resume the Tracker process

    So... my questions about this scenario are the following ones:

    • Calling update() on Tracker gets every Camera's update() method called?
    • Tracker has a QHash containing all the Cameras, but once the Camera* are added to its layout, accessing to QHash.value() methods causes the related widgets to be updated too?
    • Qt (correctly) argues that Camera's paintEvent() are not called by the GUI thread but I could not find a better solution for not blocking the QMainWindow event loop... is there anyone that has a better idea for constructing a better multithreaded scenario for this setup?

    Thanks in advance for any kind answer or suggestion about this! :)

Log in to reply