Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QT - uncheck check box

Tags:

c++

qt

qcheckbox

Guys please let me know how to uncheck the check box using QT C++.

like image 794
CrazyCoder Avatar asked Dec 23 '10 16:12

CrazyCoder


People also ask

How to set the text of qcheckbox checkbox when checkbox is unchecked?

The following code is supposed to set the text of nameLine form to this box is unchecked when the QCheckBox instance checkbox has state Unchecked. QCheckBox *checkbox = new QCheckBox ("paid with cash!", this); checkbox->setCheckState (Qt::Unchecked); if (checkbox->checkState (Qt::Unchecked)) { nameLine->setText ("the box is unchecked"); }

What is a qcheckbox widget?

The QCheckBox widget provides a checkbox with a text label. More... A QCheckBox is an option button that can be switched on (checked) or off (unchecked). Checkboxes are typically used to represent features in an application that can be enabled or disabled without affecting others.

How to partially uncheck a qcheckbutton?

Alternatively you could use setCheckState () setCheckState () method from QCheckButton. This gives you the option to 'partially uncheck' it. Show activity on this post.

How do I check if a checkbox is checked or cleared?

Whenever a checkbox is checked or cleared, it emits the signal stateChanged (). Connect to this signal if you want to trigger an action each time the checkbox changes state. You can use isChecked () to query whether or not a checkbox is checked.


1 Answers

You can use the setChecked() method from QAbstractButton.

QCheckButton b;
b.setChecked( false ); // Uncheck it

Alternatively you could use setCheckState() setCheckState() method from QCheckButton. This gives you the option to 'partially uncheck' it.

QCheckButton b;
b.setCheckState( Qt::Unchecked );
like image 180
André Avatar answered Sep 20 '22 20:09

André