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) › AppSwitch logic problem

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #19447

    Eric

    Hello,

    I’m trying to set up a basic connection between two AppSwitch elements. The connection is very simple, I have two switches, the main switch and a sub switch, as seen below.

    App {
      id: app
      property bool main_switch: false
      property bool sub_switch: false
    
      AppSwitch {
        checked: app.main_switch
        onToggled: {
          app.main_switch = !app.main_switch;
          app.sub_switch = !app.sub_switch
        }
      }
    
      AppSwitch {
        checked: app.sub_switch
        onToggled: {
          app.sub_switch = !app.sub_switch
        }
      }
    }

    When I first load the app, if I click the main switch, the sub switch also changes as expected, regardless of what the initial states are of either switch. However, once I flip the sub switch manually, the ‘connection’ is lost in that when I subsequently switch the main switch, the sub swtich no longer flips even though the value of app.sub_switch does in fact change as it should.

    It seems I’m not understanding the ‘checked’ value. It seems to me that regardless of what changes app.sub_switch to true or false, the switch itself should change, is that not true? Could someone help me understand why I’m not getting the expected action?

    Thank you.

    #19448

    Alex
    Felgo Team

    Hi,

    set updateChecked to false on the on sub switch.

    Cheers,
    Alex

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

RSS feed for this thread

You must be logged in to reply to this topic.