Befehle in Threads zugreifen auf QMainWindow lässt abstürzen
Verfasst: 17. Juni 2010 20:43
Also, in QMainWindow-Konstruktor wird ein Thread erzeugt mit:
und im thread-methode habe ich folgendes probiert:
Das Fenster hat zwar ihre Größe verändert, doch dann erscheint eine Fehlermeldung:
Code: Alles auswählen
mthread = new Thread(this);
mthread->start();Code: Alles auswählen
void Thread::run() {
QMainWindow *cparent = qobject_cast<QMainWindow *>(parent());
cparent->resize(800,800);
}Was bedeutet das?ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread a10118. Receiver 'qt_app04Class' (of type 'qt_app04') was created in thread 3a7da0", file kernel\qcoreapplication.cpp, line 305