Results 1 to 4 of 4

Thread: Unchecking QRadioButton

  1. #1
    Join Date
    Feb 2008
    Posts
    40
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Unchecking QRadioButton

    First of all - hello everyone :-)

    I would like to make QRadioButton, that would function as QCheckBox (for aesthetic reasons). I checked class description and inherited methods, but failed to find single method, that is called, when QRadioButton is pressed. I tried to use click() slot, but it doesn't seem to be called, when I press this button. I need to be able to uncheck it, when someone clicks on checked button, therefore I need to intercept this call. Could anyone tell me, which method should I subclass?

    I guess, I must use some event. If I simply call click() slot in the code, everything works just fine. But I don't know, what needs to be subclassed, when the button is clicked.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Unchecking QRadioButton

    Quote Originally Posted by gruszczy View Post
    I would like to make QRadioButton, that would function as QCheckBox (for aesthetic reasons).
    You mean "unintuitive"?

    Could anyone tell me, which method should I subclass?
    Subclass QCheckBox and reimplement paintEvent. Use QStyle API to draw the button as it would be a radio button.

  3. #3
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Unchecking QRadioButton

    Why not use Qt Style Sheets? You can make the QCheckBox look like a QRadioButton I think...

    But reimplementing it is also a way.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Unchecking QRadioButton

    Oh, by the way. Before you do anything complicated try changing the "autoExclusive" property of the radio button to false. I think it should get you your holy grail.

Similar Threads

  1. QRadioButton
    By sonuani in forum Newbie
    Replies: 1
    Last Post: 20th February 2008, 09:30
  2. QRadioButton
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 8th October 2007, 07:25
  3. Replies: 26
    Last Post: 21st July 2007, 21:34

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.