[Qt-interest] Using a QRubberBand in a QGraphicsItem

Mihail Naydenov mlists at ymail.com
Fri Apr 22 09:07:53 CEST 2011


As far as i understand, you want to mark portion of an Item.

This seems trivial - you either override its (Item's) Paint and draw a rect 
ontop, resizing on mouse events
or
have a RectItem as Item's child and resize it on mouse events.

MihailNaydenov

>
>From: "Cole, Derek" <dcole at integrity-apps.com>
>To: "qt-interest at qt.nokia.com" <qt-interest at qt.nokia.com>
>Sent: Thu, April 21, 2011 9:58:31 PM
>Subject: [Qt-interest] Using a QRubberBand in a QGraphicsItem
>
> 
>Hello,
>
>I am  trying to use a QRubberBand in a QGraphicsItem. By that, I mean that I 
>want to be able to use the QRubberBand within an individual QGraphicsItem that 
>is in my scene, which naturally would not allow selection of anything outside 
>the bounds of the QGraphicsItem.  This is to allow someone to select a portion 
>of an image that is the current focus.
>
>It seems like QRubberBand requires a QWidget to be useable though. I cant seem 
>to figure out a way to cheat here, and make QRubberBand work with QGraphicsItem. 
>
>
>
>What alternative do I have here? Do I need to try to re-implement rubberband by 

>using some variant of QGraphicsRectItem?
>
>Do I need to create an overridden version of QGraphicsScene?
>
>I am trying to do this on the image as a Ctrl+MousePress event, because 
>currently I am allowing users to pan the individual QGraphicsItems within the 
>scene by using mousepress and release. 
>
>
>Thanks for any tips
>
>
>



More information about the Qt-interest-old mailing list