Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How ignore MouseArea?
Forum Updated to NodeBB v4.3 + New Features

How ignore MouseArea?

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 4 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    korsarqa
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Maksym
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        korsarqa
        wrote on last edited by
        #3

        [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?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Gennon
          wrote on last edited by
          #4

          [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.

          /Gen

          1 Reply Last reply
          0
          • B Offline
            B Offline
            beemaneni
            wrote on last edited by
            #5

            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

            Bala B
            Infinite Computer systems
            Chennai

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved