Results 1 to 5 of 5

Thread: Two groupbox, if checked one, uncheck other

  1. #1
    Join Date
    May 2008
    Location
    Spain
    Posts
    92
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Two groupbox, if checked one, uncheck other

    Hello,

    I have this code:
    Qt Code:
    1. QObject::connect(groupBox, SIGNAL(clicked(bool)), groupBox_2, SLOT(setChecked(bool)));
    2. QObject::connect(groupBox_2, SIGNAL(clicked(bool)), groupBox, SLOT(setChecked(bool)));
    To copy to clipboard, switch view to plain text mode 

    But It do not want it.
    I am interesting in if I checked groupbox, unchecked groupbox2 and vicerversa.
    any advice?

    best regards

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Two groupbox, if checked one, uncheck other

    make your own slot a) two for both group boxes b) only one and use sender to figure out which group box was sending the signal. Or use QSignalMapper.

  3. The following user says thank you to Lykurg for this useful post:

    webquinty (13th May 2009)

  4. #3
    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: Two groupbox, if checked one, uncheck other

    Use a QButtonGroup and make it exclusive.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    webquinty (13th May 2009)

  6. #4
    Join Date
    May 2008
    Location
    Spain
    Posts
    92
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Two groupbox, if checked one, uncheck other

    Thanks a lot wysota and Lykurg.

  7. #5
    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: Two groupbox, if checked one, uncheck other

    Actually my solution is incorrect. I read your post too quickly and didn't see you were talking about a groupbox and not a checkbox. Obviously my solution works only for buttons.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. No action checked in an exclusive action group
    By SkripT in forum Qt Programming
    Replies: 12
    Last Post: 13th February 2006, 06:19

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.