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. Qt Quick: How to handle hover-type events in MouseArea, yet let lower-z MouseAreas handle them too?

Qt Quick: How to handle hover-type events in MouseArea, yet let lower-z MouseAreas handle them too?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
event-handlingmouseevent
4 Posts 3 Posters 1.4k Views
  • 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.
  • S Offline
    S Offline
    Stefan Monov76
    wrote on 11 Nov 2016, 17:15 last edited by
    #1

    If, on my MouseArea, I've enabled the property hoverEnabled, I'm notified of the entered signal, even if no mouse button is held at that time (just as I want).

    But then a lower-z MouseArea will not receive positionChanged events on the first MouseArea's space, since they're eaten up by the first MouseArea.

    The Qt docs on positionChanged specifically say this:

    When handling this signal, changing the accepted property of the mouse parameter has no effect.

    Example code:

    Item {
    	width: 100
    	height: 100
    	
    	MouseArea {
    		anchors.fill: parent
    		hoverEnabled: true
    		
    		onPositionChanged: {
    			console.log("MouseArea 1");
    		}
    	}
    	
    	MouseArea {
    		anchors.fill: parent
    		hoverEnabled: true
    		
    		onEntered: {
    			console.log("MouseArea 2");
    		}
    	}
    }
    

    "MouseArea 1" is never printed. I want both strings to be printed.

    Is there a way to do it?

    Related question note: This question is very similar but the asker there has 2 differently-sized overlapping MouseAreas, and he wants the smaller one (which is has higher z) to eat up events when the events fall within both. I want both overlapping MouseAreas to handle events that fall within both.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jalomic
      wrote on 7 May 2017, 19:09 last edited by
      #2

      Have you found the answer?

      S 1 Reply Last reply 8 May 2017, 11:03
      0
      • J jalomic
        7 May 2017, 19:09

        Have you found the answer?

        S Offline
        S Offline
        Stefan Monov76
        wrote on 8 May 2017, 11:03 last edited by
        #3

        @jalomic: No, sorry, I haven't.

        A 1 Reply Last reply 10 Mar 2024, 14:20
        0
        • S Stefan Monov76
          8 May 2017, 11:03

          @jalomic: No, sorry, I haven't.

          A Offline
          A Offline
          AliGh
          wrote on 10 Mar 2024, 14:20 last edited by
          #4

          @Stefan-Monov76 Have you found the answer?

          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