OverviewFelgo 1 Support › Trouble implementing Android back button

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #6865


    I’ve been following the Chicken Outbreak Demo as a reference. I have a SceneBase that contains

    signal backPressed
      console.debug("SceneBase: pressed key code: ", event.key)
      if(event.key === Qt.Key_Backspace && system.desktopPlatform) {
      console.debug("backspace key pressed - simulate a back key pressed on desktop platforms for debugging the user flow of 
          Android on windows!")
    Keys.onBackPressed: {

    Which is the same code used in the Chicken Outbreak SceneBase.qml


    In their MainScene.qml, they have the onBackPressed function and a Connections which prompts the user if they really want to quit. Although I personally wouldn’t want a prompt, I just copied and pasted it and all I got was the debug info “wm_char received for wparam: 8” each time I pressed backspace. So, thinking it had to do with activeScene (the target of their Connections) I tried simply adding a function in my main scene as follows

    onBackPressed: {

    and I still only get the debug info “wm_char received for wparam: 8”.


    Edit: When I run the Chicken Outbreak Demo, the backspace functionality works on that program.

    • This topic was modified 5 years, 8 months ago by  Nuggetslug.


    RESOLVED. I was tinkering around and found out what I needed to do. In my main.qml I added

    onStateChanged: {
      if (state === "main")
        activeScene = startScene //startScene is the id of the scene you wish to implement back functionality.


    In my StartScene.qml I added

      target: activeScene
      onBackPressed: {

    As I am a beginner in app development and v-play, I just modified the template code using the Connections item, although I am not sure if this is an effective way to do it (it does work, however). I hope this helps somebody out! I had to reply because I hate when searching forum posts that have my same problem and just end with “lol nevermind” and leave me hanging.


    Felgo Team


    thanks for posting the solution you found!

    For the key simulation to work on desktop, you indeed need to change the activeScene to the currently active scene, because only then the keyboard focus is handled correctly.

    Cheers, Chris

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

RSS feed for this thread

You must be logged in to reply to this topic.

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
create apps
create games
cross platform
native performance
3rd party services
game network
level editor
easiest to learn
biggest time saving
best support