View Full Version : exclusive checkBox

16th March 2006, 19:06
Hi, in designer I put in a buttonGroup 3 checkButton and make it exclusive. When application starts, nothing button is checked (ok). When I check one they then I change and exclusive works; but I'd like to de-select all checkbox: with exclusive this is impossible. Is there a simple way to obtain this?

16th March 2006, 19:33
what happens if you add a button "clear all" to your dialog and connect its clicked() signal to a slot in which you call chkBUtton->setChecked ( false ) to all the check buttons in the button group?

16th March 2006, 20:55
I didn't try! But I need de-selected in the same way of selecting....Is it possible Qt not think to this?

16th March 2006, 21:01

4th October 2007, 16:56
Hello people

I have one problem, i want to create dynamicly one group of checkboxes witch data i have to read from one SQL table.

The code :

QButtonGroup *AnsDialog::createExclusiveGroup()
int i = 0;

QSqlQuery query;

//QStringList names;

QGroupBox *groupBox = new QGroupBox(" Awnsers ");

QString s = "SELECT id, text FROM answer WHERE language =\"pt\"";

while ( query.next()) {
QString ansTemp =query.value(1).toString();
QCheckBox *q = new QCheckBox(ansTemp, groupBox);



CheckBox=new QCheckBox(Checkbox.sprintf(ansTemp,i),groupBox);


return groupBox;


I can´t compile it, is say's :

".\AnsDialog.cpp(86) : error C2228: left of '.append' must have class/struct/union"

4th October 2007, 17:02
I can´t compile it, is say's :

".\AnsDialog.cpp(86) : error C2228: left of '.append' must have class/struct/union"

'mas' and 'idAnswers' are not defined in this function.
I don't know on which one the compiler complains about since you didn't state which line is line 86.
Make sure both above variables are defined.

4th October 2007, 19:26
It could be a missing include directive. Where and how are mas and idAnswers declared? Did you include corresponding headers?