[solved] Invisible items do not receive mouse events
-
According to "this":http://qt-project.org/doc/qt-4.8/qml-item.html:
bq. In contrast, setting the visible property to false stops both mouse and keyboard events, and also removes focus from the item
hidden item does not receive mouse events...
Lets consider that I want to achieve horizontal item fading (left to right), so I use "OpacityMask":http://qt-project.org/doc/qt-5.0/qtgraphicaleffects/qml-qtgraphicaleffects1-opacitymask.html in which maskSource is LinearGradient (with animated GradientStop position).
Here is example of how to use "OpacityMask":http://qt-project.org/doc/qt-5.0/qtgraphicaleffects/qml-qtgraphicaleffects1-opacitymask.html:
@
Image {
id: bug
//...
visible: false
}Image { id: mask //... visible: false } OpacityMask { anchors.fill: bug source: bug maskSource: mask }
@
as you can see both items hidden => my item with controls does not receive mouse events though it is shown on the screen but visible property is false!
So, how can I achieve fading effect AND receive mouse events?
-
Set visible to true and opacity to some minimal value like 0.01 or so.
-
[quote author="sreich" date="1381152369"]@sierdzio, shouldn't 0.0 be fine? or is that implicitlyi setting visible to false?[/quote]
I think it will set visible to false, too. I guess the best answer is to try it out for yourself. IIRC, there is also a behaviour change here between QtQuick 1 and 2.