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
0
votes
0 answers

how to activate qt event loop on linux

Is there any way to force the program build on top of qt5 to get into it's QEventDispatcherGlib::processEvent()? Currently I am porting a program from windows to linux and repair its auto-test module, and in windows, there is so many native MSGs to…
0
votes
2 answers

How do you wait for `QtConcurrent::run` to finish without thread blocking?

Hey this should be a pretty straightforward question. Simply put: Want to run a function in another thread. Need to wait for the function to finish. Do not want to freeze the thread though while waiting. In other words, I'd like to use an…
Anon
  • 2,267
  • 3
  • 34
  • 51
0
votes
1 answer

QEventLoop in QTimer slot

I have multiple QTimer in the same thread, in the slot connected to the QTimer, I use QEventLoop for synchronization, like http requests, but I found different QTimers may affect each other when they are started in different orders. Here is my…
0
votes
0 answers

Strange signal/slot behaviour

(Working with Qt 5.15.2) I have a method which receives a signal (sig_responseReady) from the same thread. The purpose of this method is to wait until a response is received. While this method is waiting for the signal, the method is called again…
TSG
  • 4,242
  • 9
  • 61
  • 121
0
votes
1 answer

Is there a way to use QEventLoop as the main event loop in a QML application?

QML applications do not exit when using QEventLoop. The window will open just fine, but when the application window is closed, the program does not exit. It also doesn't fire any events like QGuiApplication::lastWindowClosed or…
Alex Shaw
  • 163
  • 1
  • 7
0
votes
0 answers

How to wait for another window to close in QT C++?

I have a window. When I press a button, it executes a function. That function at some point might start another window. In that window the user can do things. While that window is open, I do not the other window to be used. So here is what I tried…
SlimLamie
  • 61
  • 1
  • 7
0
votes
1 answer

QObject Child Class Not Detecting QGuiApplication Event Loop

When I try to start a QTimer in a class derived from QObject, I get the warning QObject::startTimer: Timers can only be used with threads started with QThread and the timer doesn't run. Based on answer here, it appears that my custom class is not…
0
votes
1 answer

QEventLoop in QAxWidget instance failed

I'm working on terminal based PyQt application using Windows OCX api. And I'm having trouble over implement(calling exec) QEventLoop in QAxWidget instance. If I call exec() in main QApplication main loop, everthing is fine. But, calling exec() in…
DWONH
  • 1
  • 3
0
votes
1 answer

How to terminate a QEventLoop when a Qt Dialog window is closed

In order to have more hands-on experience with Python and creating GUIs, I decided to create a flashcards quiz app. Initially, I created a simple function that accepted a csv file name, shuffled the answers and the questions, and implemented a for…
khayni
  • 11
  • 1
  • 4
0
votes
0 answers

QEventLoop in QWebEnginePage.javaScriptConfirm completely skipped

I have a subclass of QWebEnginePage where I would like to override the javaSrciptConfirm function to create my own popup. It would work by starting a QEventLoop, and connecting the QPushButton.clicked.connect signals from the OK and Cancel buttons…
SamG101
  • 488
  • 1
  • 7
  • 18
0
votes
1 answer

How to fix "In Qt two timer to one function, use qmutex will qeventloop for sleep"

I have some code use qtcpsocket to write and read, write-->sleep-->read; and ui had 2 and more timer to use this function; by i want i run synchronous;so i add mutex to lock it; by it deadlock; qt4; qt5; void MainWindow::Start() { pTimer =…
danny
  • 9
  • 2
0
votes
1 answer

QEventLoop wait for only local events not main loop events

I'm trying to execute a network request and wait for the response before moving on. Whereas using a QEventLoop works to wait for the request, the problem is if there are other signals fired in other parts of the program they will execute first. Here…
Stanton
  • 904
  • 10
  • 25
0
votes
2 answers

Is there an alternative solution for a QTimer::singleshot(0) lambda function call

I just implemented a QLineEdit that selects it's text right after getting focus. I created a derived class and added virtual void focusInEvent(QFocusEvent *event) override; to the header. I first tried to implement it like so: void…
Tobias Leupold
  • 1,512
  • 1
  • 16
  • 41
0
votes
1 answer

How some objects are created before main event loop?

While debugging, I came up with strange for me thing. In the main function, I commented out creation of window as follows: #include #include #include //#include "mainwindow.h" int main(int argc, char *argv[]) { …
Bobur
  • 545
  • 1
  • 6
  • 21
0
votes
1 answer

Understanding Qt multithreading and event loop

I am looking for clarification to help me understand Qt multi threading and event loops with Qt 4.8. I would also add I am new to threading in general so that is part of my problem. My current situation is I have a Qt app that needs to play sounds…
JavaBeast
  • 766
  • 3
  • 11
  • 28