how to decide which layer in a WStackedWidget handles events
Added by Arjan Vermeij almost 13 years ago
I have a subclass of WStackedWidget that shows all of its child widgets. I first add all child widgets, then call my WStackedWidget's close method, which does this:
void Witty::Widget::Composite::Stack::WStackedWidget::close ()
{
if (count () > 0) {
setCurrentIndex (0);
for (int index = 1; (index < count ()); index++) {
widget (index)->show ();
}
}
}
In one particular configuration I have a WStackedWidget with two children, a WGoogleMap and a WImage. The WImage is meant as an overlay on top of the WGoogleMap widget. It is mostly transparent, allowing to see the WGoogleMap through the WImage. This works fine.
But now the WGoogleMap no longer reacts to mouse events. Instead, the mouse events are received by the WImage.
I tried calling
WImage::setDisabled (true)
but that does not make any difference.
Help is very much appreciated. Arjan.
Replies (3)
RE: how to decide which layer in a WStackedWidget handles events - Added by Arjan Vermeij almost 13 years ago
I found a solution myself: I added this
pointer-events: none;
to the css for the WImage widget. This works, at least in Chrome. But is this the proper solution?
Thanks, Arjan.
RE: how to decide which layer in a WStackedWidget handles events - Added by Koen Deforche almost 13 years ago
Hey,
I didn't know this was even possible using CSS!
So I wouldn't know any other way... except maybe using custom JavaScript to forward the events.
Regards,
Koen
RE: how to decide which layer in a WStackedWidget handles events - Added by Arjan Vermeij almost 13 years ago
I have no idea how this would fit into wt, if at all. But it's a great feature, see attached screen shot. The markers are part of the WGoogleMap widget, the transparent bull's eyes and the white labels are rendered through svg in a WImage widget.
Arjan.