[Interest] Qml MouseArea visible and containsMouse

Jérôme Godbout jerome at bodycad.com
Thu May 21 15:41:16 CEST 2015


Seem related to this bug:
https://bugreports.qt.io/browse/QTBUG-36191

On Thu, May 21, 2015 at 9:36 AM, Jérôme Godbout <jerome at bodycad.com> wrote:

> Hi,
> I found a weird behavior with the containsMouse and the mouseArea which I
> could not explain. When creating mouseArea with visible at false, seem to
> corrupt the containsMouse and make it true even if mouse is not above it.
> Here's a small sample to reproduce the bug (Windows 7, Qt 5.3.0):
>
> import QtQuick 2.3
> import QtQuick.Controls 1.1
>
> Row
> {
> spacing: 2
>  Button
> {
> id: toggleVisible_
> checkable: true
> checked: false // starting this at true is ok mouseArea are created with
> containsMouse at false. If checked is false containsMouse are true after
> clicking on it
> text: 'Toggle Visible'
> }
>  Repeater
> {
> model: 5
> MouseArea
> {
> width: 50
> height: 50
> hoverEnabled: true
> visible: toggleVisible_.checked
> acceptedButtons: Qt.LeftButton
>  // only to display containsMouse state
> Rectangle
> {
> anchors.fill: parent
> color: parent.containsMouse ? 'red' : 'blue'
> }
> }
> }
> }
>
> If the toggleVisible_.checked is set to true into the script at launch,
> the rectangle will be blue (containsMouse is false) upon creation like they
> supposed to be. If we put it to false to begin the script, then click on
> the button to toggle the visiblility, they all appear but red like the
> mouse was hover all of them!
>
> Anybody have a work around this, this is causing quiet a problem for us.
>
> Thanks, regards,
> Jerome
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150521/6c5b3aa5/attachment.html>


More information about the Interest mailing list