PDA

View Full Version : thread GUI access crash



liqxpil
14th December 2010, 12:54
hi

i'm trying to make multible threads access and modify a textedit in the GUI, i used a signal from the thread to transfer a QString to the main windows slot which prints it.

however it works when i start one thread only, but it shows this message:


QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)

and starting multible threads crashes the program. is it because im connecting multiple signals to the same slot?

squidge
14th December 2010, 13:10
The message is stating exactly what is wrong, please show your connect statement.

liqxpil
14th December 2010, 14:48
solved
just removed the the connection type from my connect statement (it was Qt:: DirectConnection)

chris_helloworld
14th December 2010, 15:47
Is it a good idea to update a GUI from another thread. When I'm doing this type of thing, I usually pass a message from the worker thread to the GUI thread. Avoids a lot of problems when various GUI objects aren't thread safe.