Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Do I need to use threading?
Qt 6.11 is out! See what's new in the release blog

Do I need to use threading?

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
1 Posts 1 Posters 572 Views
  • 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.
  • S Offline
    S Offline
    sofiane
    wrote on last edited by JKSH
    #1

    [Thread locked. Duplicate of https://forum.qt.io/topic/128611/do-i-need-to-use-threading/ --JKSH]

    I'm currently using qcustomplot (https://www.qcustomplot.com/index.php/demos/simpledemo) to plot some curves on a window, like the following,

    f83dbafb-c637-4977-989c-5542b54d02cf-image.png
    but what I'm trying to do is to change the values of the vector representing the y axis, plot them, and doing that each 1 second.
    Suppose for example that we have Qvector<int> x, as increasing integers from 0 to 250, and QVector<int> y as x², 0², 1², 2² ....etc, then each second I want to add noise to each y[i] and plot it. Therefore we wil have a noisy curve changing each second.

    In order to do that each second, I need to use the sleep() function from <unitstd.h>, but this function prevents the window from opening. Therefore I thought it's because the program is stuck 99.99 % of the time on the sleep function, maybe I need another thread that sleeps and loads the data, and another that displays the window?

    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