Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
qthread or qtconcurrent.
if i have a sort function in ascend order. then plot the data in QT pixelmap and color it base on the value. I have few of these pixelmap window, each run the same sort function but each has different input data, and data update in the ms. to run these concurrently, can this type operation achieve by qthread/movetothread type or using qtconcurrent? or something better.
Threading is threading, QtConcurrent simply offers you high level tools that avoids you the need to manage threads yourself.
QtConcurrent will likely fill the bill if used correctly.
if my sort function is declare in a Qwidget class. do i need to put that function in Qobject or Qthread class before using
Did you read the documentation about QtConcurrent run ?
i read this
it didn't mention if function declare in Qwidget class is fine for qtconcurrent. The reason i ask is because movetothread require Qobject etc.
Watch out, you're not allowed to modify GUI elements from other threads.
You should take that kind of thing into account when designing your application.
ok thanks, but if my function only doing some background calculation(for example sorting), it just happen to be declare in Qwidget. it should be fine right?
It should but it won't be clean.
You should rather properly separate responsibilities. Otherwise you are going to end up with code that will be difficult to maintain and understand.