×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386

    how to select a particular button

    Hi,

    I have a QButtonGroup of 5 QRadioButtons. The selection is exclusive by default, so I was expecting to only be able to select one of them at a time. Indeed, as a user I can only select one at a time - selecting another button deselects the first; however, if I call setDown() on one of the buttons, it does not deselect the currently selected button and I end up with two selected.

    So, my question is, how can I programmatically select buttons so that the behaviour is as if the user had pressed them?

    My code is here - in the UiController::displayRoute() method' at the end, I want to make it so that the first button is selected (and only the first button). The table is created here in the Ui::setUpUi() method (nothing much to see, but anyway).

    Max.
    Using Qt4.6.2 on Maemo5.

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: how to select a particular button

    What do you mean by "selected" -- checked or focused or something else?

    Should you be using setChecked rather than setDown?

  3. #3
    Registered User
    Join Date
    Sep 2006
    Location
    Beijing, China
    Posts
    386

    Re: how to select a particular button

    Quote Originally Posted by danhicksbyron View Post
    What do you mean by "selected" -- checked or focused or something else?

    Should you be using setChecked rather than setDown?
    Yes, setChecked() works perfectly. Thanks!

Similar Threads

  1. Replies: 5
    Last Post: 2010-05-30, 18:25
  2. Replies: 35
    Last Post: 2009-04-11, 14:36
  3. Replies: 4
    Last Post: 2007-11-22, 11:11
  4. Middle Select Button on Nokia 3650
    By njacharya21 in forum Mobile Java General
    Replies: 6
    Last Post: 2006-02-20, 18:51
  5. Menu Select button using List object
    By abstractworlds in forum Mobile Java General
    Replies: 4
    Last Post: 2002-12-09, 13:08

Posting Permissions

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