×

Discussion Board

Results 1 to 6 of 6

Thread: qml switch

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    31

    qml switch

    Dear developers,
    Can anyone tell me what is the signal handler for qml switch element because when I use "onclicked" or "onchecked "it is not a valid property.The only option valid is "onclipchange".In the qt doc,the valid signal is "clicked" but what handler should be use to use the signal as it is not mentioned in the doc.Also the "checked" property cannot be use.Is it a bug or something.My app target is symbian and I use latest qt creator version.Thank you.

    http://doc.qt.digia.com/qt-component...ml-switch.html

  2. #2
    Regular Contributor
    Join Date
    Feb 2012
    Posts
    124

    Re: qml switch

    From what I see the key to using the switch is in this line of code:
    text: switchComponent.checked ? "Switched on" : "Switched off"
    The "switchComponent.checked ? " test will automatcially update when the switch is flicked.
    You can add some more actions to that switch test, or alternatively within the text area also test for onTextChanged : {

  3. #3
    Registered User
    Join Date
    Oct 2012
    Posts
    31

    Re: qml switch

    Quote Originally Posted by CLTSchwarz View Post
    From what I see the key to using the switch is in this line of code:

    The "switchComponent.checked ? " test will automatcially update when the switch is flicked.
    You can add some more actions to that switch test, or alternatively within the text area also test for onTextChanged : {
    Thank you for the alternative.Gonna try it tomorrow

  4. #4
    Registered User
    Join Date
    Mar 2013
    Posts
    1

    Re: qml switch

    Hi,

    I had a similar issue using the Switch element (symbian components 1.1), it looks like this element not emit any signal (any onSomething).
    My currently workaround is to use a CheckBox.

  5. #5
    Registered User
    Join Date
    Oct 2012
    Posts
    31

    Re: qml switch

    I think it is a bug.Somehow qt creator didn't recognise it.I found some open source app that use switch element and open it with qt creator.Qt creator didn't recognize the "checked" property and the "oncheckchanged" signal handler,say it is not valid property but when compile,the app works find.Below is the code

    Code:
    Switch {
    52	        id: fbSwitch
    53	
    54	        anchors {
    55	            left: fbImg.right
    56	            leftMargin: 10
    57	            verticalCenter: fbImg.verticalCenter
    58	        }
    59	        visible: facebook.authenticated
    60	        checked: true
    61	    }
    62	
    63	    Button {
    64	        id: fbButton
    65	
    66	        anchors {
    67	            left: fbImg.right
    68	            leftMargin: 10
    69	            verticalCenter: fbImg.verticalCenter
    70	        }
    71	
    72	        font {
    73	            family: "Impact"
    74	            pixelSize: platformStyle.fontSizeSmall

  6. #6
    Registered User
    Join Date
    Oct 2012
    Posts
    31

    Re: qml switch

    Found the solution.There is no need for signal handler to handle function.The "text :" property itself can be use to handle function.

    Code:
    text: switchComponent.checked ? "switchon()" : "switchoff()"
    Just need to put the switch function directly in the "text :" .Example "switchon()" is for opening the function while "switchoff()" to close the function.There are no signal handler for switch element.

Similar Threads

  1. How to switch between different SDK?
    By wiso33 in forum Symbian
    Replies: 7
    Last Post: 2010-01-20, 10:09
  2. Replies: 2
    Last Post: 2009-04-24, 04:19
  3. timer switch off or switch on (n95 8g)
    By xiangqiuzhao in forum Symbian
    Replies: 2
    Last Post: 2008-10-20, 04:10
  4. Switch TCP/IP
    By mrcantos in forum General Development Questions
    Replies: 1
    Last Post: 2008-08-28, 04:36
  5. Circuit Switch & Packet Switch at the same time on Series60 Platform
    By TrickLo in forum Symbian Networking & Messaging (Closed)
    Replies: 9
    Last Post: 2006-04-09, 15:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×