Results 1 to 3 of 3

Thread: QCheckBox dependency

  1. #1
    Join Date
    Feb 2008
    Posts
    21
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QCheckBox dependency

    Hello, i have a problem with QCheckBox.

    I have two checkboxes:
    Checkbox A and Checkbox B

    Checkbox A is dependently on checkbox B
    Cehckbox B is dependently on checkbox A

    If I set checkbox A checked(true), checkbox B must be set checked(false).
    If I set checkbox B checked(ture), checkbox A must ne set checked(false).

    The problem is i can not handle this in one SLOT-function, because I don't know wich checkbox released the SIGNAL toggled(bool).

    Connects:
    Qt Code:
    1. connect(AcheckBox, SIGNAL( toggled( bool ) ),
    2. this, SLOT( dependencyCheckBox( bool )));
    3. connect(BcheckBox, SIGNAL( toggled( bool ) ),
    4. this, SLOT( dependencyCheckBox( bool )));
    To copy to clipboard, switch view to plain text mode 

    How can I find out which checkbox was checked? Can I handed Over the object name?



    so long

    jd
    The most difficult in the world is to live in it

  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: QCheckBox dependency

    Quote Originally Posted by jd View Post
    If I set checkbox A checked(true), checkbox B must be set checked(false).
    If I set checkbox B checked(ture), checkbox A must ne set checked(false).
    Why don't you use radio buttons instead? If you don't want them, at least take a look at QButtonGroup.

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

    jd (1st April 2008)

  4. #3
    Join Date
    Feb 2008
    Posts
    21
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QCheckBox dependency

    QRadioButton works fine.

    thanks.
    The most difficult in the world is to live in it

Similar Threads

  1. qmake+flex dependency problem
    By nurtsi in forum Qt Programming
    Replies: 1
    Last Post: 20th February 2008, 08:11
  2. QCheckbox
    By sonuani in forum Qt Programming
    Replies: 1
    Last Post: 19th February 2008, 13:12
  3. How QCheckBox into QListWidgetItem?
    By Teuniz in forum Qt Programming
    Replies: 3
    Last Post: 23rd July 2007, 20:31
  4. Replies: 11
    Last Post: 18th May 2007, 10:38
  5. qCheckbox back ground color
    By sreedhar in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2006, 18:44

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.