MenuButton.qml Example File

demos/Squaby/qml/common/MenuButton.qml
 import QtQuick 2.0
 import VPlay 2.0

 Item {
   property alias source: image.source

   signal clicked
   signal pressAndHold

   property bool active: false
   property bool clickable: true

   width: image.width
   height: image.height

   MultiResolutionImage {
     id: image
     source: "../../assets/img/menu-downloaded.png"
     opacity: parent.clickable ? parent.active ? 0.4 : 1.0 : 0.1
   }

   MouseArea {
     anchors.fill: parent
     hoverEnabled: true
     enabled: parent.clickable
     onClicked: {
       parent.scale = 1.0
       parent.clicked()
     }
     onPressed: {
       parent.scale = 0.85
     }
     onReleased: {
       parent.scale = 1.0
     }
     onCanceled: {
       parent.scale = 1.0
     }
     onPressAndHold: parent.pressAndHold()
   }
 }

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