View Full Version : exclusive checkBox
mickey
16th March 2006, 18: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?
Thanks
high_flyer
16th March 2006, 18: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?
mickey
16th March 2006, 19:55
I didn't try! But I need de-selected in the same way of selecting....Is it possible Qt not think to this?
jpn
16th March 2006, 20:01
http://www.qtcentre.org/forum/showthread.php?t=531
RuiVilela
4th October 2007, 15: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\"";
query.exec(s);
while ( query.next()) {
QString ansTemp =query.value(1).toString();
QCheckBox *q = new QCheckBox(ansTemp, groupBox);
mas.append(*q);
idAnswers.append(query.value(0).toString());
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"
high_flyer
4th October 2007, 16: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.
jpn
4th October 2007, 18:26
It could be a missing include directive. Where and how are mas and idAnswers declared? Did you include corresponding headers?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.