Forums

OverviewFelgo 2 Support (Qt 5) › AppSwitch logic problem

Tagged: 

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

    Felgo User

    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.

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