Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Swich Control - How to get True or false?
QtWS25 Last Chance

Swich Control - How to get True or false?

Scheduled Pinned Locked Moved Solved General and Desktop
qmlcontrols 2
3 Posts 2 Posters 979 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mathan M
    wrote on 10 Oct 2016, 10:16 last edited by p3c0 10 Oct 2016, 10:17
    #1

    Hi,

    I want to get switch state like true or false, Am I doing this right?

    Code snippet:

        Switch {
                    id: idswitch
                    checked: false
                    onCheckedChanged: {
                        console.log("Switch");
    
    if (idswitch.state == "on")
                          {
            console.log("toggle - True");
              }
    
    if (idswitch.state === true)
                          {
            console.log("toggle - True");
              }
    
                      }
                }
    

    Anything else to add, like
    states: [
    State { name: "state1"; when: sharedCondition },
    State { name: "state2"; when: sharedCondition }
    ]

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p3c0
      Moderators
      wrote on 10 Oct 2016, 10:19 last edited by
      #2

      @Mathan-M
      checked property returns true or false

      157

      M 1 Reply Last reply 10 Oct 2016, 10:34
      2
      • P p3c0
        10 Oct 2016, 10:19

        @Mathan-M
        checked property returns true or false

        M Offline
        M Offline
        Mathan M
        wrote on 10 Oct 2016, 10:34 last edited by
        #3

        @p3c0

        Thank you.

        1 Reply Last reply
        0

        2/3

        10 Oct 2016, 10:19

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved