[Interest] QGraphicsItem: How to limit the position to which it is moved?
Douglas Scott
douglas.a.scott at gmail.com
Wed Apr 11 06:37:49 CEST 2012
I am new to QT 4.0. I have a QGraphicsItem subclass which I need to
constrain its positioning when it is dragged on the screen by the mouse.
For example, if another of these objects is visible on the screen, I want
to be sure the x coordinate of the new one is always >= to the old. Also I
want to have the option of constrained movement, where the object can only
be moved vertically, if I choose.
I do not understand where I can intercept the setting of the object's
position on the screen. I thought I could redefined
QGraphicsItem::itemChange() and watch for ItemPositionChange and HasChanged
-- but I never get any of these notifications. Given that setPos() is not
overridable, where can I force limitations on my object's positioning?
Thanks.
-DS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120410/cd31b7a0/attachment.html>
More information about the Interest
mailing list