How ignore MouseArea?



  • Hello.
    I have MouseArea on the entire area for my sliding menu.
    But i have other MouseArea on the buttons. How i can ignore that?



  • What do you want to ignore?

    As I understood you should use z-order of your mouse areas.

    Like that

    [code]
    MouseArea {
    id: area1
    z: 1
    }
    MouseArea {
    id: area2
    z: 2
    }
    [/code]

    area2 overlaps area1.



  • [quote author="Maksym" date="1407228505"]What do you want to ignore?

    As I understood you should use z-order of your mouse areas.

    Like that

    [code]
    MouseArea {
    id: area1
    z: 1
    }
    MouseArea {
    id: area2
    z: 2
    }
    [/code]

    area2 overlaps area1.[/quote]

    so, i have MouseArea
    This MouseArea covers a total area of my program

    @ MouseArea {
    property int startX: 0
    property int dragX: pressed ? mouseX - startX : 0
    property int dragThreshold: gv_.width * 0.2
    id: mouseArea
    anchors.fill: parent
    onPressed: {
    startX = mouseX
    }
    onReleased: {
    if (dragX > dragThreshold)
    gv_.onMenu();
    if (dragX < 0-dragThreshold)
    gv_.onMenu();
    }
    }@

    But on the background, I have a few more MouseArea
    But they do not work, how to fix it?



  • [quote author="korsarqa" date="1407226270"]Hello.
    I have MouseArea on the entire area for my sliding menu.
    But i have other MouseArea on the buttons. How i can ignore that?[/quote]

    [quote author="korsarqa" date="1407238566"]
    so, i have MouseArea
    This MouseArea covers a total area of my program
    But on the background, I have a few more MouseArea
    But they do not work, how to fix it?[/quote]

    So you want one big area that responds to mouse clicks, but on it you have some buttons that responds differently to mouse clicks?

    If that is the case then it should work to either set the z-value of the buttons to a value larger than the big area, or you could define the buttons inside the big area in QML.

    I think your problem is that the big area is above your buttons (has a higher z value than your buttons) and will catch all mouse inputs.

    Let me know if my assumptions are wrong.



  • Hi
    Gennon is right.
    on pressed you can reduce the z-value to less than back z mouse area.so that at that point of time back button mouse area will be focussed. And when back button mouse area is clicked u can do vice versa...

    Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.