Results 1 to 6 of 6

Thread: Change position according to QCheckBox State

  1. #1
    Join Date
    Jun 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Change position according to QCheckBox State

    Hi

    I want to change the position of an object on the map if according to the state of the Qcheckbox i.e. till the Qcheckbox is in checked state the position of the object would be altered and stop when QCheckbox is unchecked ?

    How can i achieve this ? Is there any inbuilt function or if a timer is needed to be used ?

    I am using Qt 4.6 on Kubuntu 10.04.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Change position according to QCheckBox State


  3. #3
    Join Date
    Jun 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Change position according to QCheckBox State

    Thanks. But it only works when the state changes. i want to perform the task till it is in checked state.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Change position according to QCheckBox State

    Then, yes, you need a loop or timer

  5. #5
    Join Date
    Jun 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Change position according to QCheckBox State

    thanks. would setting autoRepeat Property of QCheckBox to true (through Qt Designer) and passing clicked(bool) signal to the desired method is equivalent to having a timer or a loop ?

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Change position according to QCheckBox State

    It might be. To me this looks like a bad choice though.

    I guess I would choose the timer. Use the checkbox state to start or stop the timer. Then use the timer event to update the position

Similar Threads

  1. how to change the position of menu of QMainWindow
    By yxmaomao in forum Qt Programming
    Replies: 11
    Last Post: 17th September 2016, 17:12
  2. Replies: 1
    Last Post: 11th December 2009, 18:21
  3. QCheckBox change color
    By vajindarladdad in forum Newbie
    Replies: 4
    Last Post: 6th October 2009, 09:33
  4. Disabling the user to change QCheckBox checkstate
    By ChiliPalmer in forum Qt Programming
    Replies: 1
    Last Post: 26th September 2009, 17:20
  5. How to change defualt color of QCheckbox box?
    By darshan.hardas in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2008, 14:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.