Forums

OverviewV-Play 1 SupportMouseArea not releasing after "swipe" › Reply To: MouseArea not releasing after "swipe"

OverviewV-Play 1 SupportMouseArea not releasing after "swipe" › Reply To: MouseArea not releasing after "swipe"
#4447

David

Hi TSigmund,

I’m not sure where your actual problem occurs in detail. Maybe you can test following example and describe your problem in more detail. Which platform do you test?

import VPlay 1.0
import QtQuick 1.1

GameWindow {
  id: gameWindow

  Text {
    text: button.state
    color: "white"
  }

  Rectangle {
    id: button
    x: 50
    y: 50
    width: 50
    height: 50

    signal pressed()
    signal released()
    signal clicked()

    MouseArea {
      id: mouseArea
      anchors.fill: parent

      onPressed: {
        console.debug("BUTTON pressed")
        button.opacity = 0.5
        button.pressed()
        button.state = "pressed"
      }
      onReleased: {
        console.debug("BUTTON released")
        button.opacity = 1.0
        button.released()
        button.state = "released"
      }

      onExited: {
        console.debug("BUTTON exited")
        button.opacity = 1.0
        button.released()
        button.state = "exited"
      }

      onMousePositionChanged: {
        console.debug(mouseX,mouseY)
      }

      onCanceled: {
         console.debug("BUTTON canceled")
         button.opacity = 1.0
         button.released()
        button.state = "canceled"
      }

      onClicked: {
        console.debug("BUTTON clicked")
        button.clicked()
      }
    }
  }
}

The example produces following console output when I use the button in the described way.

Pressed button and moved around inside the button. Released button, still inside the button. 

BUTTON pressed
20 27
...
21 27
BUTTON released
BUTTON clicked
BUTTON exited

Pressed button and moved around inside the button. Still pressed, but move outside of the button (exited) and move around outside. Released somewhere outside the button.

BUTTON pressed
16 19
...
17 19
BUTTON exited
51 21
...
52 21
BUTTON released

Cheers,

David

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support