Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, June 2007
graphicsview moving items on the scene


Message 1 in thread

Hello there.

I was writing visual editor in Qt 3.x but after read about Qt4.x 
features (with graphics view) i decided to upgrade my code. 
Unfortunately I'm quite newbie in Qt graphics system. Now I have my 
application ported to Qt4 by after porting canvas view to graphics view 
system I'm not able to move my graphics item over the scene. Under Qt3.x 
I had code which take care about moving items with all children if there 
any. I don't know, are children able to be moved after mousePressEvent 
and MoseMoveEvent by default without any code?

Best regards

--
 [ signature omitted ] 

Message 2 in thread

Przemysław Staniszewski wrote:
> Hello there.
>
> I was writing visual editor in Qt 3.x but after read about Qt4.x 
> features (with graphics view) i decided to upgrade my code. 
> Unfortunately I'm quite newbie in Qt graphics system. Now I have my 
> application ported to Qt4 by after porting canvas view to graphics 
> view system I'm not able to move my graphics item over the scene. 
> Under Qt3.x I had code which take care about moving items with all 
> children if there any. I don't know, are children able to be moved 
> after mousePressEvent and MoseMoveEvent by default without any code?

Yes, see the QGraphicsItem flags: 
http://doc.trolltech.com/4.3/qgraphicsitem.html#GraphicsItemFlag-enum

Specifically, look at the ItemIsMovable flag that allows users to drag 
items without any code.

--Dave

--
 [ signature omitted ]