Questions tagged [qthread]

QThread is a threading class provided by the cross-platform Qt framework.

As of Qt 4.3, the default QThread object executes an event loop in his run() method. Thus, it is discouraged to subclass QThread for concurrent execution. Instead all operations which are required to be executed concurrently should be encapsulated into one or more QObject with signals and slots as a mechanism to communicate data. These objects can then be "moved" to the Qthread object.

This allow concurrent programming without the need for a lock, a condition variable, or a semaphore

Helpful links:

Frequently Asked Questions About QThread:

1528 questions
0
votes
1 answer

QTimer, QThread, and TCP messaging

Qt 4.8, Windows XP: I have a thread that manages my TCP messages and opens / maintains / closes the socket at the appropriate times. This same thread starts a QTimer, 200 ms, defined in my thread's data, that pumps an event in my thread's class once…
fyngyrz
  • 2,458
  • 2
  • 36
  • 43
0
votes
1 answer

python threads synchronization

I have a python app that goes like this: main thread is GUI there is a config thread that is started even before GUI config thread starts a few others independent threads => How can I let GUI know that all of those "independent threads" (3.) have…
kosta5
  • 1,129
  • 3
  • 14
  • 36
-1
votes
1 answer

strange behavior of qt emit using qthread

struct C : public QObject { Q_OBJECT public: C() { qDebug()<<"C()"; //connect(this,SIGNAL(cs()),this,SLOT(cl2()),Qt::QueuedConnection); } ~C(){qDebug()<<"~C()";} signals: void cs(); public slots: …
camino
  • 10,085
  • 20
  • 64
  • 115
-1
votes
0 answers

Can QPixmaps be used in background thread?

I tried drawing in a QPixmap in worker thread . It works as expected . But as per documentation it is not recommended to draw in worker thread . What are the consequences of creating and adding in background thread? How do i measure the rendering…
Akshaya S
  • 1
  • 2
-1
votes
0 answers

Usage/implementation of mutex-based ringbuffer in pyqt

In my project I have three threads (QThreads, pyqt-based with PySide 6), one for generating data, one for processing, and one for visualization/forwarding. As data processing typically is much slower than generating, the buffer for the incoming data…
arc_lupus
  • 3,942
  • 5
  • 45
  • 81
-1
votes
1 answer

Why does the same signal need to be connected to the main circuit slot method to be triggerable?

I have two threads, a main thread and a sub-thread, and a signal in the main thread that's connected to the slot method in the main thread and the sub-thread respectively. I emit this signal in the destructor of the main thread and want to trigger…
-1
votes
1 answer

How to combine QTimer with QThreadPool to get real-time?

I am trying to put a QTimer inside a QThreadPool. The reason is that I need to count real-time since the start of a process (recording video), but the actual code seems to be lagging a bit and the time counted is far from real-time. However, when…
Ad Ep
  • 23
  • 7
-1
votes
1 answer

Qt - QThread Signal&Slot No Error Just not Working

I updated my question. My project is so simple. I want to create 3 thread. Each thread have different operations. Finally, they should communicate using signal&slot. I got…
if4k
  • 19
  • 5
-1
votes
1 answer

Real-Time Graph Plotting using PyQt graph (GUI FREEZING during plotting graphs)

I am facing an issue during plotting graph in real-time in pyqt widget application that i made for my ECG hardware. Basically, I am sending my ECG-data in csv format via usb and trying to capture that data in "PyQt Widget application" and after…
-1
votes
1 answer

Connecting to two server from client in qt

I need simultaneous persistent connection to two Servers from my Qt TCP client. Do I need threads for this or there is another way. Any Examples would be great.
D_Ranjan
  • 1
  • 1
-1
votes
1 answer

PyQt5 QProgressBar Does Not Appear when run in QThread

This question was deleted, but I updated the code to an MRE. I have run it on my terminal and it does not have any compilation/runtime errors, but behaves as I explain below. Since the moderators have not responded to my original request to reopen…
adam.hendry
  • 4,458
  • 5
  • 24
  • 51
-1
votes
3 answers

Qt: do I need a mutex if there is only one writer thread?

configuration:debug result: program exit with code 0. configuration:release result: main thread infinite loops,wont jump out of the loop(t.n==0 is true). how can I get out of the loop ? Only one writer thread,so I didnot use any mutex. qt5.13…
kenash0625
  • 657
  • 3
  • 8
-1
votes
1 answer

PyQT5 Multi Thread Issue

I am trying to run Multithread using PYQT5 & Qthread I have two pushbutton associated to threads (progressbar & one action waiting for 1 sec and then print "done") that are working perfectly as they are declared within the same Class. I do have a…
Pat130614
  • 1
  • 1
-1
votes
2 answers

How to start a loop on a QThread

How can I start a loop on a different thread by pressing a QPushButton? The main idea is, when pushButtonStart is clicked, start a loop on a QThread, and when pushButtonStop is clicked, stops the loop in the QThread. The loop can be done by QTimer,…
joaopedro
  • 75
  • 9
-1
votes
1 answer

Why does PyQt application crash or hang when using QThread on macOS?

When calling a thread class in PyQt5, the application crashes with error: QThread: Destroyed while thread is still running if I don't add def __del__(self): self.wait() After adding the above statement to the thread class, the application…
pyropeach
  • 13
  • 4
1 2 3
99
100