Marble weirdness

Dirk Hohndel dirk at hohndel.org
Tue Jun 4 22:50:06 PDT 2013


On Tue, 2013-06-04 at 22:43 -0700, Thiago Macieira wrote:
> On quarta-feira, 5 de junho de 2013 14.16.14, Dirk Hohndel wrote:
> > So we implement the virtual mousePressEvent() in our GlobeGPS class.
> > 
> > Yet we don't get single mouse clicks. They are eaten somewhere else in
> > the stack. What we do get is double clicks - even though this is NOT the
> > mouseDoubleClickEvent() handler. And then even if we call
> > event->accept() at the end of our mousePressEvent() function, a click
> > still gets delivered to our parents and the widget does strange
> > re-center/zooming things.
> > 
> > Am I just doing this wrong? Am I expecting the wrong behavior? Is this a
> > Fedora bug?
> 
> You're not doing anything wrong, nor is this a Fedora bug.
> 
> It looks like MarbleWidget installs an event filter on itself instead of 
> handling events the proper way (by overriding mousePressEvent, like you did). 
> Event filters are called with a higher priority than the event handler itself. 
> That's not how I would have designed the code myself, but I also don't know 
> the decisions that led to this implementation (it was like that in the first 
> commit, "Importing Marble").
> 
> However, it looks like there's an input handler class:
> http://api.kde.org/4.10-api/kdeedu-apidocs/marble/html/classMarble_1_1MarbleWidgetInputHandler.html
> 
> Maybe installing a handler of your own will allow you to do what you want?

Just as your email came in I pushed out a tiny change to master. You can
connect to a Marble signal:

connect(this, SIGNAL(mouseClickGeoPosition(qreal, qreal,
GeoDataCoordinates::Unit)), this, SLOT(mouseClicked(qreal, qreal,
GeoDataCoordinates::Unit)));

And then you get the position of a single click.

Not what I expected, but it seems to work. And it's very much consistent
with your explanation, I think.

Thanks

/D



More information about the subsurface mailing list