When to use Multithreading?



  • Hello,

    i´m asking for a feedback, if i have reached a point where i need multithreading.
    I have made an exercise where i´m using QPainter to paint a coordinate system and a graph.
    There is a timer´s timeout running and on each timeout the next graph´s point is plotted with the value
    of a slider at that time out. So the graph grows from left to right with time dependent x-axis
    and a slider dependent y-axis. The timer is started the first time when i change the slider.

    Point of interest:
    when i make a layout = new QVBoxLayout in main() and add two of the "MyGrapWidgets" only the one i use first is active and gets plotted. Is this the point to use multithreading?

    your´s sincerly,
    Moe



  • Definitely this does not calls for creating the threads. General inputs is that if you are doing some background task which consumes time, you are better of creating the threads do the work.



  • I don´t really understand the answer, may be it´s because i´m not native english speaker. Could you formulate it differently?


  • Lifetime Qt Champion

    Hi,

    Dheerendra meant that it's not the case. You should start thinking about using thread if you have some heavy computation going on your data before painting.

    You more likely have a bug in your code.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.