[Qt-interest] click-through qwidget?
Frank Hemer
frank at hemer.org
Wed Aug 4 01:00:20 CEST 2010
On Wednesday 04 August 2010 00:14:08 Glenn Hughes wrote:
> Hi everyone...
>
> There must be some way to do this. I have a qwidget subclass which is
> essentially an overlay (NOT an OpenGL overlay, just an overlay over
> regular widgets) over some other widgets. I'm inserting it into the
> parent widget after its layout has been set, and explicitly resizing
> it to stay in sync with the parent's geometry in the parent's
> resizeEvent method.
>
> The problem is that clicks, and I'm assuming other events, don't get
> dispatch to the "real" child widgets. Strangely redraw events DO get
> dispatched, so graphically everything is working correctly... the only
> problem is if the overly is in place I can't interact with the
> underlying child widgets at all.
>
> So, is there some way to make a widget essentially "transparent" to
> clicks (except of course if the click lands on something I'm actually
> drawing in the overly). In other words, how do I do my own hit testing
> within the widget? I've tried even overriding "event" in my overlay
> widget and simply ignoring everything and returning false for
> everything (as an experiment). Doesn't help a bit. Still can't click
> on the underlying widgets.
>
> There must be a simple explanation for this... You've been able to
> have non-rectangular widgets since Qt 4 I believe, so there must be
> some way of allow events through the "transparent" areas.
@see here:
http://doc.qt.nokia.com/4.6/qwidget.html#setAttribute
http://doc.qt.nokia.com/4.6/qt.html#WidgetAttribute-enum
Qt::WA_TransparentForMouseEvents is what you are looking for
Frank
More information about the Qt-interest-old
mailing list