Questions tagged [qeventloop]

The QEventLoop class, part of the Qt framework, provides a means of entering and leaving an event loop.

At any time, you can create a QEventLoop object and call exec() on it to start a local event loop. From within the event loop, calling exit() will force exec() to return.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

99 questions
1
vote
0 answers

Qt QEventLoop CPU usage reaches maximum

Whenever I run a QEventLoop while waiting for a thread to finish background work, CPU usage goes up to 100% even if the thread does a lot of waiting in its function and doesn't do intense calculations. It's the event loop that loads the CPU. Is…
ulak blade
  • 2,515
  • 5
  • 37
  • 81
1
vote
1 answer

QEventLoop: get time when an event was scheduled

Is it possible to get the time when an event has been scheduled to a QEventLoop (e.g. the QCoreApplication event loop)? I have a situation where the main event loop is paused. When it's reactivated the events are fired and I am interested in the…
Hyndrix
  • 4,282
  • 7
  • 41
  • 82
1
vote
0 answers

QMessageBox .gif file is not visible

I have a QMessageBox and I put an animated gif on this Dialog with QLabel and inside QMovie instead of an icon. But there is a problem with the gif. When I refresh the screen somehow QMessageBox is working but the gif is not visible…
Wilmort
  • 294
  • 2
  • 15
1
vote
1 answer

How to use QTimer singleShot with QEventLoop in Qt

I need to open QDialog by using QTimer singleShot and wait for a status flag. If this variable is true then continue. This is my code StatusFlag = FALSE; void MainWindow::OpenWindow() { qDebug("OpenWindow"); NewGUI *gui=new NewGUI(); …
Pamba
  • 776
  • 1
  • 16
  • 29
1
vote
1 answer

Strange undocumented QTimer/QEventLoop behaviour after the timer is manually restarted

I have recently stumbled upon this while working with QTimer that calls a function with internal QEventLoop So, say we have a QTimer instance QTimer* timer = new QTimer; somewhere in the constructor we start it and it begins ticking away once…
Zeks
  • 2,265
  • 20
  • 32
1
vote
3 answers

Qt: deadlock after calling QEventLoop::exec

I have a rather simple application that seems to deadlock under certain conditions when I invoke QEventLoop::exec. The application calls this function in two scenarios: when certain data arrives on the socket upon a timer event in both cases it is…
krakovjak
  • 51
  • 1
  • 7
1
vote
2 answers

Queue several QTimers calls to slots

I'm using a library where I need to call a trigger function that starts some processing (starts a thread that does the job) and returns immediatly. Then when the processing is finished a signal is emitted. This needs to be done periodically based on…
Fracu
  • 835
  • 1
  • 13
  • 28
1
vote
1 answer

QFile saves files on program quit, wont save ~500MB files at all

Yeah guys, it's me again. I have following code: void MainWindow::on_startButton_clicked() { QNetworkAccessManager *nam = new QNetworkAccessManager(this); QNetworkReply *re = nam->get(QNetworkRequest(QUrl("http://somesite/ai/iai.jpg"))); …
user3343366
  • 353
  • 1
  • 3
  • 15
1
vote
1 answer

How to Start Qt Event Process without blocking?

This is my scenario: I have a dll (with Qt in the back-end, and with no event loop started). I am able to perform the signal-slot communication with-in this dll (there is a only one thread). I would like to use the facilities of QFileSystemWatcher…
1
vote
1 answer

Difference between a thread with and without an event loop

Thread with an event loop We have created a QTcpServer object in a separate thread and it is listening for incoming connections and processing them as they occur. At some point the is deleted and there is nothing to generate events in the thread.…
TheMeaningfulEngineer
  • 15,679
  • 27
  • 85
  • 143
1
vote
1 answer

when and how to use PySide QEventLoop

I have an application in which I tried using a while loop but the application just hangs, and now I think I need to use QEventLoop to make the application work here is some of the relevant code def ex_initialator(self): """ sets up things for…
H.J_Rios
  • 125
  • 4
  • 12
1
vote
1 answer

QT4Reactor / Scrapy / PyQt4

How to use Qt4Reactor the right way? I have a PyQt4 Application running Scrapy to parse a website and show the results in the ui. When the user clicks a button, the scraper gets started in another process. The ui blocks and the scraper is running.…
user937284
  • 2,454
  • 6
  • 25
  • 29
0
votes
0 answers

How do I debug a bottleneck in a large-scale Qt application?

Recently, I was debugging something in a very big Qt application. The problem is that I have a stuck (lag) application sometimes. I tried so many things and different ways to find which one was blocking the GUI thread. I disabled so many parts of…
H.M
  • 425
  • 2
  • 16
0
votes
1 answer

Is it safe to assume that using a QEventLoop is a correct way of creating qt5-compatible coroutines in python?

I'm using a custom QEventLoop instance in my code to simulate the QDialog.exec_() function. That is, the ability to pause the python script at some point without freezing the GUI, and then, at some other point of time after the user manually…
Carl HR
  • 776
  • 5
  • 12
0
votes
0 answers

Pyqt Qtimer.singleshot in QEventloop

@QtCore.pyqtSlot() def startVideo(self): global image run_video = True while run_video: ret, image = self.camera.read() color_swapped_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) …