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
11
votes
2 answers

Why should nesting of QEventLoops be avoided?

In his Qt event loop, networking and I/O API talk, Thiago Macieira mentions that nesting of QEventLoop's should be avoided: QEventLoop is for nesting event Loops... Avoid it if you can because it creates a number of problems: things might reenter,…
MuchToLearn
  • 339
  • 3
  • 12
9
votes
2 answers

QEventLoop proper usage

I have doubts how should I use QEventLoop. I have 2 pieces of code, both of them work for me (get web resource downloaded). First one: QNetworkAccessManager *manager = new QNetworkAccessManager( this ); QNetworkRequest…
Bartek Boczar
  • 257
  • 1
  • 3
  • 7
9
votes
1 answer

Is it possible to create local event loops without calling QApplication::exec()?

I'd like to create a library built on top of QTcpServer and QTcpSocket for use in programs that don't have event loops in their main functions (because the Qt event loop is blocking and doesn't provide enough timing resolution for the real-time…
Nicolas Holthaus
  • 7,763
  • 4
  • 42
  • 97
9
votes
1 answer

How to use Qt-Dbus bindings without blocking the main thread

My goal is to create a library using the Qt's DBus bindings. I tried to create a Qt application without launching the QEventLoop (provided by the QCoreApplication class) in the main thread. Here is a minimalistic application sample, working fine…
ben-du_a
  • 103
  • 1
  • 5
7
votes
2 answers

PySide wait for signal from main thread in a worker thread

I decided to add a GUI to one of my scripts. The script is a simple web scraper. I decided to use a worker thread as downloading and parsing the data can take a while. I decided to use PySide, but my knowledge of Qt in general is quite limited. As…
Peter Throwson
  • 405
  • 2
  • 5
  • 7
6
votes
5 answers

QTimer::SingleShot fired after object is deleted

// Example class class A : public QObject { Q_OBJECT void fun() { Timer::SingleShot(10, timerSlot); //rough code } public slot: void timerSlot(); } auto a = SharedPointer(new A); a->fun(); a->reset(); // a deleted In this…
JamesWebbTelescopeAlien
  • 3,547
  • 2
  • 30
  • 51
5
votes
1 answer

How local QEventLoop works

My question is general and related to the use of the class QEventLoop in QT. I have two main questions about it. question 1) how it works internally inside QT (my main concern is why the execution of a QEventLoop object is not blocking the QT…
user3722440
  • 243
  • 1
  • 6
  • 14
5
votes
1 answer

Does calling QDialog::exec in a slot block the main event loop?

My Qt application's main window is a normal QMainWindow subclass. In that window I have a few buttons; each has its clicked signal connected its own slot, and each slot creates a different QDialog like so: void onButtonA_clicked() { MyADialog*…
user4520
  • 3,401
  • 1
  • 27
  • 50
5
votes
2 answers

Qt library event loop problems

I'm writing a DLL that is used as a plugin by another application and would like to leverage Qt's abilities. I have all of the classes set up, compiling and running, but no signals are being emitted. So it seems as though there's no…
Marc
  • 2,593
  • 2
  • 18
  • 21
4
votes
2 answers

Managing keyboard events between Win32 app and QWinMigrate

I have integrated a Qt dialog into a traditional Win32 application, and am now a bit stumped on how to manage the keyboard events propagating from Qt->Win32. Is there any way test if Qt is 'handling' events (eg, input going to an editbox), and…
FrozenKiwi
  • 1,362
  • 13
  • 26
4
votes
2 answers

Qt: Multi-Threaded DLL Design

Intro This is an open ended question that I thought could be beneficial to the community because I have been unable to find great documentaton in regards to this. Unfortunately, I learned the hard way that implementing a DLL in Qt is different than…
4
votes
1 answer

QTimer->remainingTime() returns -1371648957

When I run the following code using Qt 5.3.2 the remaining time is set to -1371648957. QTimer *timer = new QTimer(this); timer->setSingleShot(true); timer->start(100); qDebug() << "remaining" << timer->remainingTime(); If I continue to print the…
Dreiven
  • 687
  • 3
  • 9
  • 22
4
votes
3 answers

Qt: How to wait for multiple signals?

I'm developing a GUI test library of sorts using PySide and Qt. So far it works quite nicely when the test case requires waiting for only one condition to happen (such as a signal or a timeout), but my problem is having to wait for multiple…
Teemu Karimerto
  • 395
  • 5
  • 12
4
votes
3 answers

Execute slots inside a QThreadPool

I have a class that should run in a thread and needs an event loop for the slots, currently I run it nicely with moveToThread(), but I'd like to use QThreadPool and I have encountered a problem. When run with QThreadPool the run() method of my…
Paul
  • 20,883
  • 7
  • 57
  • 74
3
votes
1 answer

Undocumented ProcessEventsFlag enums in QT

I noticed that modal dialogs on QT uses a local QEventLoop with the ProcessEventFlags set as "DialogExec" eventLoop.exec(QEventLoop::DialogExec); The QT assistant has no information on what this enum means. There is another one called…
Vikas Bhargava
  • 691
  • 1
  • 9
  • 22
1
2 3 4 5 6 7