Am 24.01.2014 um 18:21 schrieb Thiago Macieira <thiago.macie...@intel.com>:
> On sexta-feira, 24 de janeiro de 2014 18:19:20, Till Oliver Knoll wrote: >>> I /assume/ that it works, just like it works with Qt. >> >> Well, then it must work with "Cocoa only", too - case solved > > So you *can* run Qt and Cocoa things in a different thread than main() was > run on. I am not sure I am following you here properly: is this a statement based on something you actually tried yourself, or is it a statement you want me to confirm? Your "_So_ you can run..." formulation sounds a little bit like you're deriving something from something that I said, which on its turn is based on the *asumption* (sic! One more ;)) that your initial statement "just like it works with Qt" really meant "Using a POSIX thread and a *Cocoa* based Qt it is possible to start the Qt event queue in a separate "GUI thread" (and that is really something that has been confirmed by someone for real). However I just spotted the weak point of my assumption ;) The Qt event queue is most likely /not/ using NSApplication, nor its Cocoa event queue (nor most other Cocoa classes such as NSUndoManager which seem to insist to run on the "main thread"). So the fact that a "Cocoa based QApplication" runs fine in a POSIX created thread (which probably causes NSThread:isMainThread to always return "YES", and all involved Cocoa classes used by Qt are hence happy) does not necessarily mean that the same is true for a "pure" NSApplication based Cocoa app ;) > However, NSApplication is not thread-safe, so QApplication and NSApplication > must be in the same thread, whichever it is. The initial question was how to place a *QApplication* in a separate "GUI thread", so by now I think the answer is "yes, as long as the thread is created with the POSIX API and *not* by NSThread (as to fool the involved Cocoa classes that they are still in the "main thread")." The NSApplication thing was just me trying to verify whether it was *really* not possible to place a Cocoa app in an NSThread (we don't know yet about POSIX threads - but who cares, it works with Qt ;)). Happy week-end, all! Oliver _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest