[solved] QDeclarativeItem wrong MouseArea
glinbob last edited by
Well i'm stupid i guess... :) It was indeed my qml fault, the problem was another element with a higher z value, which was hidden (visible = true, but height=0) but still it seems to get the mouse events neither does it propagate them...
i'm currently struggling with the following:
given a QDeclarativeItem subclass displayed via a custom QDeclarativeView which just loads a qml file. The component looks fine and as expected, it also gets mouse events, to some extent, thats where the problem is:
the mousePressEvent is not triggered/emitted for the whole visible rectangle. boundingRect(), and shape().boundingRect() look correct to me, both are somewhat like [0,0,width(),height()] with the correct values, this->sceneBoundingRect() also returns what one would expect, the same width/height but translated x,y values for the actual position.
In short, my button component is only clickable in some part of it, in this particular example just in the lower half. It's not about translated/transforming the mouse event, because the slot isn't even called.
I also tried to set the component's z-property to some high value to ensure there is no other component 'stealing' the mouse events.
I suppose i'm missing some signal i should react to or some slot i should override? Or is it a problem on the qml side, where my lets say component hierarchy/layout/anchoring is broken?
as an edit/update, even more confusing: while the mouse rect for the press event is wrong, mouse move events works perfect. That is after you press and hold the mouse, moving the mouse in and out (with button still pressed) works fine with respect to the actual visible shape... thats weird?!