[Qt-interest] QGraphicsView QGraphicsProxyWidget event forwarding
Karol Krizka
kkrizka at gmail.com
Thu Jul 2 20:25:37 CEST 2009
On Thu, 2009-07-02 at 14:06 -0400, Steven Green wrote:
> I am new to QT and QGraphicsView.
>
> I am exploring QGraphicsView and implementing a bunch of features I want
> my application to handle, but am still in a play/learn phase.
>
> I want to be able to use QWidget in a QGraphicItem and have been using
> QGraphicsProxyWidget to do this, but I want to be able to grab the item
> anywhere in its bounds to move it when the right tool is selected, but I
> don't want the Widget to respond.
>
> I want the events to effect the the item instead of the widgets and
> vice-versa at times.
>
I have had to do something similar in my application. However, in my
case each QGraphicsProxyWidget was a QWidget with a lot of child buttons
and other controls. So, all I had to do was to loop through all of the
QWidget's children and disable them. I can't just disable the top
QWidget, because disabling it would also disable the
QGraphicsProxyWidget that contains it. (and thus no mouse events would
be sent to the QGraphicItem).
If that does not work for you, you could look into
QObject::eventFilter()
http://doc.qtsoftware.com/4.5/qobject.html#eventFilter
> I have attempted subclassing widgets, subclassing items, and now looking
> at the view and scene but I am hoping I am just doing something wrong or
> missing something as I am getting deep and figuring it out by looking at
> the Qt source for ideas.
>
> Any tips on how to approach this issue would be appreciated.
>
--
Cheers,
Karol Krizka
http://www.krizka.net
More information about the Qt-interest-old
mailing list