[Interest] Questions about QGraphicsWidget

BRM bm_witness at yahoo.com
Wed Aug 8 15:54:40 CEST 2012

> From: Bo Thorsen <bo at fioniasoftware.dk>

> Subject: Re: [Interest] Questions about QGraphicsWidget
> Den 07-08-2012 18:59, Bill Crocker skrev:
>>  On 08/07/2012 12:36 PM, BRM wrote:
>>>  I'm working on a QGraphicsWidget version of something I already 
>>> have a QWidget version of; namely because I need to add some features where I 
>>> need to overlay items, lines, and text in a way that QWidget does not support
>>  You can also overlay your existing widget with another widget
>>  on which you draw arbitrary text and lines.
>>  Set the overlay widget as transparent to mouse events.
> This was exactly what I was about to answer. Going to QGW is the wrong 
> approach for this problem. Unless of course there are other reasons for 
> doing it. But it sounds like the OP is only converting to QGW to do this 
> one thing.

Besides picking up the additional performance? Updating to the new APIs?
Being able to eventually move to integrating with QML (if and when QML becomes an option)?

Yes there are other reasons for doing the conversion. This is just the only aspect that I've had trouble with.

> You can create any QWidget with the top widget as parent and call 
> raise() to bring it to the front of the other widgets. That will give 
> you an overlay widget inside the window.
> For overlays, I usually do this:
>      setAttribute(Qt::WA_TranslucentBackground);
>      setFocusPolicy(Qt::NoFocus);
> in the constructor.

An interesting idea, but how then do I map specific points within the original widget (which has internal scaling, matrix tranformations, drag 'n drop movement of the drawn data, etc) to the QGraphicsScene?
I need to draw lines to specific coordinates within the widget if I were to do that; and based on how it draws I doubt that's possible.

Please correct me if I'm wrong.


More information about the Interest mailing list