Results 1 to 3 of 3

Thread: Qchekbox problem!!!!! :)

  1. #1
    Join Date
    Feb 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Qchekbox problem!!!!! :)

    Hello

    i have a question about the QCheckbox.
    -I have a checkbox (checkbox1) when I click on the checkmark I want that checkbox2(checkbox2) is also checkmarked.
    How can i do this?

  2. #2
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Qt products
    Qt4
    Platforms
    Windows Android
    Thanks
    69
    Thanked 10 Times in 8 Posts

    Default Re: Qchekbox problem!!!!! :)

    Read here: http://qt-project.org/doc/qt-4.8/signalsandslots.html about the signals and slots concept of Qt.

    You can connect the
    Qt Code:
    1. stateChanged ( int state )
    To copy to clipboard, switch view to plain text mode 
    signal of the first checkbox to a self-defined slot that checkmarks the other one.

    N.B.: If you do this vice-versa, you should be aware that it might be nessecary to temporarily disconnect the connection in order not to get into an infinite loop.

  3. #3
    Join Date
    Apr 2012
    Posts
    14
    Qt products
    Qt3 Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Qchekbox problem!!!!! :)

    You can also use.
    Qt Code:
    1. if(QCheckbox1->isChecked())
    2. QCheckbox2->setChecked(true);
    To copy to clipboard, switch view to plain text mode 
    Last edited by karthic; 27th April 2012 at 11:22.

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
  •  
Qt is a trademark of The Qt Company.