Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › Button Bug?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #17840

    Seth Chhum

    I am having problem with button stuck issue. I am not sure whether it is a bug within Qt or V-play engine.

     

    Issue: Buttons get stuck (disabled,no response) when repeatedly pressed them with 3 fingers several times.

    Tested Devices: iPad Air 2 (WiFi+Cellular) iOS 11.1.2, HTC One  M9 Android Nougat

    Tested Apps:  Kid Alphabet Phone (I am building for my son), One Card! (OK button on HTC One M9, haven’t tested it with the iPad) and Add buttons from V-play tutorial https://felgo.com/doc/vplay-get-started-games/ ( you can  change myButton width and height to 200 and 100 respectively to make it easier to test)

    Mybutton.qml

       id: myButton
       width: 200
       height: 100

     

    Can anyone confirm this bug please?

    #17845

    Günther
    Felgo Team

    Hi Seth!

    I did a quick test on Android and didn’t run into this issue with a simple button like this:

    import Felgo 3.0
    import QtQuick 2.9
    
    App {
      id: app
    
      Rectangle {
        id: button
        width: dp(200)
        height: dp(100)
        color: "#32665a"
        anchors.centerIn: parent
    
        property int counter: 0
    
        Text {
          text: "Add 1"
          color: "white"
          anchors.centerIn: parent
        }
    
        MouseArea {
          anchors.fill: parent
          onClicked: {
            button.counter++
            console.debug("button clicked "+button.counter)
          }
        }
      }
    }

    The clicked signal is always fired correctly for me, even when quickly tapping with three or more fingers.
    Can you provide a minimum example similar to the above, where your issue is easily reproducible?

    Best,
    Günther

     

     

    #17854

    Seth Chhum

    Build on V-play 2.14, Qt Creator 4.4.1, Mac OS 10.11.6

    Tested on iPad Air 2 (Wifi+Cellular) iOS 11.1.2 and HTC One M9 Android 7.0

     

    Here is the Demo Video  . It will be deleted after 7 days.

    Mybutton.qml

    import QtQuick 2.0
    import Felgo 3.0
    
     Rectangle {
     id: myButton
     width: 200
     height: 100
     color: mouseArea.pressed ? "#546632" : "#32665a"
    
     property alias labelText: label.text
     signal clicked
    
     Text {
     id: label
     text: "Some Default Value If Needed"
     color: "white"
     anchors.centerIn: parent
     }
    
     MouseArea {
     id: mouseArea
     anchors.fill: parent
     onClicked: {
     myButton.clicked()
     }
     }
     }

     

    Main.qml

     

    import Felgo 3.0
    import QtQuick 2.0
    
    GameWindow {
     id: gameWindow
     screenWidth: 960
     screenHeight: 640
    
     Scene {
     id: scene
     width: 480
     height: 320
    
     property int score: 0
    
     Rectangle {
     anchors.fill: scene.gameWindowAnchorItem
     color: "#324566"
     }
    
     Text {
     text: "Score " + scene.score
     color: "white"
     anchors.horizontalCenter: scene.gameWindowAnchorItem.horizontalCenter
     anchors.top: scene.gameWindowAnchorItem.top
     }
    
     Column {
     anchors.centerIn: scene
     spacing: 10
    
     Mybutton {
     labelText: "Add 1"
     onClicked: {
     scene.increaseScore(1)
     }
     }
     Mybutton {
     labelText: "Add 10"
     onClicked: {
     scene.increaseScore(10)
     }
     }
     }
    
    
     function increaseScore(amount) {
     scene.score += amount
     }
     }
    }
    #17858

    Günther
    Felgo Team

    Hi,

    Thanks for the video and your code sample!

    I was now able to verify the issue -> it seems to only occur on certain devices / OS versions. Looks like the QML MouseArea by Qt does not release the pressed state correctly with many touch inputs in some cases.

    As an alternative, you can switch to a MultiPointTouchArea instead, which handles multiple touch-points more safely:

    Rectangle {
        id: myButton
        width: 300
        height: 300
        color: touchArea.isPressed > 0 ? "#546632" : "#32665a"
        anchors.centerIn: parent
    
        Text {
          id: label
          text: "Press Me"
          color: "white"
          anchors.centerIn: parent
        }
    
        MultiPointTouchArea {
          id: touchArea
          anchors.fill: parent
    
          property bool isPressed: false
          onPressed: {
            isPressed = true
            console.log("PRESSED!")
          }
          onReleased: isPressed = false
        }
      }

     

    Best,
    Günther

    #17881

    Seth Chhum

    Thank you for the solution. However, my 1 year old son was still able to make the buttons stuck on the iPad.

    Fortunately, they can be easily unstuck by pressing them again this time.

Viewing 5 posts - 1 through 5 (of 5 total)

RSS feed for this thread

You must be logged in to reply to this topic.