[Qt-interest] Box Pick Zoom
Ross Bencina
rossb-lists at audiomulch.com
Thu Aug 13 14:04:51 CEST 2009
Hello Sujan
I don't have a simple answer, but what I do for similar things is process mouse events at the scene level: when the mouse goes down I create a rectangle QGraphicsItem which provides the box feedback, when the mouse is released I deleteLater() the item and do whatever needs to be done (in your case, zooming).
I have implemented the Interactor design pattern on top of QGraphicsScene to allow all events to be intercepted by one or more Interactor objects rather than requiring mouse events to be routed through GraphicsItems.. this makes this kind of interaction eaiser, but you should be able to get the same effect by overriding QGraphicsScene::event() and intercepting mouse events when you're in "zoom" mode.
HTH
Ross.
===================================
AudioMulch 2.0 is here!
http://www.audiomulch.com
----- Original Message -----
From: Sujan Dasmahapatra
To: qt-interest at trolltech.com
Sent: Thursday, August 13, 2009 9:04 PM
Subject: [Qt-interest] Box Pick Zoom
Dear Friends
I have a QGraphicsView, QGraphicsScene and a bunch of QGraphicsItem.
all the items are in the scene and displayed in view. I want to provide box pick zoom in and zoom out to the items or to the view.
so in the slot when user clicks for zoom in I am enabling rubberband selection mode.
//something like this.
MainWindow::ZoomIn()
{
view->setRubberBandSelectionMode (Qt::ContainsItemShape);
}
//////////////////////////////////////////////
but when I click on zoom in no rubber band is appearing.Can anyone suggest me how could I achieve box pick zoom for my view and items in the view. ??
--
Thanks & Regards
S. Dasmahapatra
B.E. (Aeronautics-Aerodynamics)
Bangalore, India
Ph:91-9900839788
Office:91-80-66470248
mail id : sujan.dasmahapatra at gmail.com
------------------------------------------------------------------------------
_______________________________________________
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/20090813/3ba69d78/attachment.html
More information about the Qt-interest-old
mailing list