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

Qt slot simultaneous disconnect and call from different theads

I'm newbie to Qt. I haven't found an answer in a reasonable time and decided to ask here. I have a thread, let's call it Thread1 with Qt object which have a connected slot. Signal is emitted from the same thread (Thread1). And I'm disconnecting this…
Vasily
  • 235
  • 3
  • 14
0
votes
1 answer

using threading for a qt application

I have the following two files: import sys import time from PyQt4 import QtGui, QtCore import btnModule class WindowClass(QtGui.QWidget): def __init__(self): super(WindowClass, self).__init__() self.dataLoaded = None # …
evan54
  • 3,585
  • 5
  • 34
  • 61
0
votes
1 answer

How to get the working time of a thread in c++/qt?

I'm new in the C++ and QT-Programming and want to get the time in milliseconds that a QThread needed to execute one task. Is there any option for this? Greetings
501 - not implemented
  • 2,638
  • 4
  • 39
  • 74
0
votes
1 answer

Qt QProcess Complains about QThread::Start , Thread Creation Error

I have an extremely simple app that is supposed to use QProcess to do some systemd control. Then entire program is below. Every time I run the app, it complains with the following: QThread::start: Thread creation error: Resource temporarily…
PhilBot
  • 748
  • 18
  • 85
  • 173
0
votes
1 answer

Xlib: unexpected async reply when testing Qt application from a separate QThread within same Qt application

I am trying to create a test for my Qt appication. The aim is to test the GUI of the application by moving the mouse around and clicking on QGraphicsItems or QWidgets using the X11 library. The test is written as a plugin for my Qt application. It…
safe_malloc
  • 824
  • 2
  • 12
  • 29
0
votes
1 answer

multiple threads invoking using qthread

Its my basic question i want to ask the experts regarding my design before i start coding I have to invoke five different threads 3 of UDP send/recv with individual structure 2 of Multicast UDP with individual structure 1 of Serial Can i…
Wagmare
  • 1,354
  • 1
  • 24
  • 58
0
votes
0 answers

What is the proper way to separate the view layer from the logic layer in QT?

My mainwindow have a side GUI with a QGraphicsView in the center, there is a logic class which make different calculations which triggered by the GUI and effects the QGraphicsView. Some of the calculations are heavy which make the GUI go to sleep,…
GoldenAxe
  • 838
  • 3
  • 9
  • 26
0
votes
1 answer

ui is protected, but how to use it in the reimplemented Qthread run() function

I want to reemplement the run function creating my own class of QThread. I've created this, class MyThread : public QThread { public: void run(); }; void MyThread::run() { gui w; w.listen_device(w.ui->comboBox->currentIndex()); …
SamuelNLP
  • 4,038
  • 9
  • 59
  • 102
0
votes
1 answer

Affecting a QDialog From A QThread

I would like to affect a QDialog from a separate thread, I have to do two things: dialog->show(); dialog->raise(); dialog->activateWindow(); As far as I understand, these are events and thus MUST be done in the main thread event loop. I think I…
Constantin
  • 16,812
  • 9
  • 34
  • 52
0
votes
4 answers

Qt thread and loop issue

this is the run method of a subclass of QThread: void crono::Controller::run() { //initialise timer int *i = & this->model->seconds_elapsed; for (*i = 0; *i < this->model->seconds_total; (*i)++) { //calculate current…
alessiop86
  • 1,285
  • 2
  • 19
  • 38
0
votes
1 answer

QThread and Phonon

I am writing a C++ GUI application using Qt Creator (based on 32-bit QT 4.8.0). My goal is to create an application which plays nature sounds at random, with various attributes for each sound. I am trying to use the Phonon library to play these…
lightningmanic
  • 2,025
  • 5
  • 20
  • 41
0
votes
2 answers

Qt emit signal to object moved to thread

In order to initiate stopping a thread by setting a flag (and then returning from within the thread), I need to communicate with it. The threading is implemented like this MyClass* obj = new MyClass(0); connect( this,SIGNAL( stop() ),obj,…
handle
  • 5,859
  • 3
  • 54
  • 82
0
votes
1 answer

QThread related problems

I'm having some problems and questions about QThread. 1) When I use QThread->quit(), finished() signal is not emitted.. 2) How is right way to build and finish execution of thread? 1) finished signal code - the header file. #ifndef…
Nika
  • 1,864
  • 3
  • 23
  • 44
0
votes
1 answer

QThread Executing Multiple Times

I have written a short program here designed to record and play back my mouse motions. I've implemented a simple GUI in PyQt and had it working in the past. Recently I decided to update the code to make it less 'hacky' by implementing QThread…
TerryTate
  • 414
  • 3
  • 14
0
votes
1 answer

Thread Serialisation in Qt using QThread

I want to implement a condition as described in the . I want to make Thread 1 wait till Thread 2 has completed doing some job and after Thread 2 finishes the job Thread 1 should be made to wake up. Will I use a QWaitcondition or simple sleep()…
rotating_image
  • 3,046
  • 4
  • 28
  • 46