Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Android do not detect the onLeave signal of mouseArea(Qt5.2)
QtWS25 Last Chance

Android do not detect the onLeave signal of mouseArea(Qt5.2)

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 3 Posters 1.3k 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
    stereomatching
    wrote on last edited by
    #1

    mac OS X 10.8.5
    Qt5.2

    tried api 10,14,15,19
    compile with armeabi

    @
    import QtQuick 2.0

    Rectangle {
    width: 360
    height: 360

    MouseArea {
        id: mouseArea
    
        property bool isEnter: false
    
        anchors.fill: parent
        hoverEnabled: true
    
        onEntered: {
            //console.log("enter")
            mouseArea.isEnter = true
        }
    
        onExited: {
            //console.log("exit")
            mouseArea.isEnter = false
        }
    }
    
    Rectangle{
        id: selected
        anchors.fill: parent
        color: mouseArea.isEnter ? Qt.lighter("blue") : "white"
        //visible: styleData.selected
    
        SequentialAnimation {
            running: mouseArea.isEnter; loops: Animation.Infinite
            NumberAnimation { target:selected; property: "opacity"; to: 1.0; duration: 500}
            NumberAnimation { target:selected; property: "opacity"; to: 0.5; duration: 500}
        }
    }
    

    }
    @

    The code work perfectly under mac, but not on android
    Do anyone have the same issue?
    Any workaround could deal with it?
    Thanks

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Fahmy
      wrote on last edited by
      #2

      This is my guess, in touch screen device. There is no hover function like mouse have in Desktop environment.

      So there will be no mouse in or leave out event because you need to hover mouse pointer in and out of the area to make it happen.

      Stay hungry, stay foolish.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stereomatching
        wrote on last edited by
        #3

        [quote author="Fahmy" date="1386916949"]This is my guess, in touch screen device. There is no hover function like mouse have in Desktop environment.

        So there will be no mouse in or leave out event because you need to hover mouse pointer in and out of the area to make it happen.[/quote]

        Thanks, my experiment show that the in event always trigger, but the leave event may or may not trigger.Do you have a workaround to mimic the in and leave event behaviors?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DerMas
          wrote on last edited by
          #4

          Instead of defining your own boolean you can use the "pressed" boolean from the MouseArea:

          @color: mouseArea.pressed ? Qt.lighter("blue") : "white"@

          That should solve your problem.

          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