Discussion:
[Qt-interest] Can an Qt Application contain 2 mainwindow?
Till Oliver Knoll
2011-09-22 18:29:15 UTC
Permalink
The error happens when I try to new b window in other thread.
Meeep! Bummer! ;) A classic one I'd say ;)

You can only create or modify widgets in the "main" (aka "GUI") thread - the thread where QApplication "lives in", to be specific (which usually happens to be the thread which the OS starts for you when calling your entry main() function, since that is the place where one usually instantiates QApplication).

Check the Qt thread docs again, specifically the chapter about "painting and threads".

Cheers, Oliver

Loading...