[Qt-interest] QGraphicsScene problem

Scott Aron Bloom Scott.Bloom at sabgroup.com
Sat Aug 29 10:44:05 CEST 2009


Put a breakpoint in QObject at the warning message.  Then see who is
calling the timer...

Somewhere in your code there is a timer kicking off

 

Scott

 

From: Patric [mailto:userqt at gmail.com] 
Sent: Saturday, August 29, 2009 1:40 AM
To: Scott Aron Bloom; qt-interest at trolltech.com
Subject: Re: [Qt-interest] QGraphicsScene problem

 

I don't have any timers. 

But I have found that when the item's moveBy() functions is called, the
warning is given. 

 

The scene is in the main thread, the worker thread possesses a pointer
to the scene. 

And the worker thread is trying to move the item's in the scene around. 

	----- Original Message ----- 

	From: Scott Aron Bloom <mailto:Scott.Bloom at sabgroup.com>  

	To: qt-interest at trolltech.com 

	Sent: Saturday, August 29, 2009 11:21 AM

	Subject: Re: [Qt-interest] QGraphicsScene problem

	 

	The timer is owned/constructed in one theread, and is being
started/stoped by the worker thread.

	 

	Try calling moveToThread to move the timers into the worker
thread...

	 

	Scott

	 

	From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Patric
	Sent: Saturday, August 29, 2009 1:11 AM
	To: qt-interest at trolltech.com
	Subject: [Qt-interest] QGraphicsScene problem

	 

	Hello guys, 

	I have QGraphicsScene here with items on it. 

	 

	I have manual control (i.e. keyboard events) and also auto
control (through a thread which makes all the calculations where these
QPixmapItems should interact). 

	 

	When I control them, everything is OK. 

	But when I start the auto control, i.e. my thread which
simulates the actions, I'm observing a very strange behaviour. It's a
game actually, it's turn based. 

	So somethimes the objects on the board are just not moving on
their turns. 

	 

	I have implemented this simulation engine with the technique
used in the Mandelbrot example. 

	 

	In my MainWindow class I have instance of the engine thread, and
when some button in the GUI is pressed MainWindow calls a method in the
thread (directly), which wakes the thread. 

	And I'm getting this shit : 

	 

	QObject::killTimer: timers cannot be stopped from another thread


	QObject::startTimer: timers cannot be started from another
thread

	QObject::killTimer: timers cannot be stopped from another thread

	QObject::startTimer: timers cannot be started from another
thread

	QObject::killTimer: timers cannot be stopped from another thread

	QObject::startTimer: timers cannot be started from another
thread

	 

	Any ideas why ? 

	 

	Regards, 

	Patric

	 

	p.s.:in the end of the thread's run method there is sleep call
also. 

________________________________

	_______________________________________________
	Qt-interest mailing list
	Qt-interest at trolltech.com
	http://lists.trolltech.com/mailman/listinfo/qt-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090829/6f4e5ff4/attachment.html 


More information about the Qt-interest-old mailing list