4 ms·
Some Qt APIs are inherently asynchronous (like QHttp) but the graphics-related ones I'm binding to are not (like QPainter). So the situation is analogous to t
by arturadib 15y ago
Some Qt APIs are inherently asynchronous (like QHttp) but the graphics-related ones I'm binding to are not (like QPainter).
So the situation is analogous to the DOM in web browsers. The calls are synchronous and run in the main thread. As the web has taught us though, single-threads and blocking graphics calls can go a long way :)
- iamleppert 15y agoTrue, but Qt specifically (as well as many OS such as Mac OSX) do not allow running of the GUI in anything but the main thread. This is due to the fact that (from what I've read) graphics drivers are not thread safe. Just wondering how you got around this...I see you're using processEvents in QApplication. from http://doc.qt.nokia.com/4.7-snapshot/thread-basics.html http://doc.qt.nokia.com/4.7-snapshot/thread-basics.html: GUI Thread and Worker Thread As mentioned, each program has one thread when it is started. This thread is called the "main thread" (also known as the "GUI thread" in Qt applications). The Qt GUI must run in this thread. All widgets and several related classes, for example QPixmap, don't work in secondary threads. A secondary thread is commonly referred to as a "worker thread" because it is used to offload processing work from the main thread.
- arturadib 15y ago> do not allow running of the GUI in anything but the main thread That's right. AFAIK everything is running in a single thread.
- icefox 15y agoOn X11 I actually have a bunch of patches so I wrote for Qt so I could do painting in another thread. It was useful for a project where I was injecting QtWebKit into a game where the main thread was the game and the Qt event loop and all its processing had to exists on a different thread sending a single opengl buffer across when rendered. I got some patches into Qt, but others were rejected for one reason or another (could no reproduce, not supported etc), but nonless it was a very cool project.