15 #include <QButtonGroup>
16 #include <QVBoxLayout>
17 #include <QHBoxLayout>
18 #include <QGridLayout>
25 mSelectionList(selectionList),
26 mButtonGroup(new QButtonGroup(parent))
28 if (orientation==Qt::Vertical)
29 mLayout =
new QVBoxLayout(
this);
31 mLayout =
new QHBoxLayout(
this);
33 this->setTitle(title);
35 this->populate(exclusive);
44 QList<QAbstractButton*> applicationButtonList = mButtonGroup->buttons();
45 foreach(QAbstractButton* button, applicationButtonList)
47 if(button->isChecked())
48 retval << button->text();
55 this->filter(selectedlist);
60 QList<QAbstractButton*> applicationButtonList = mButtonGroup->buttons();
61 foreach(QAbstractButton* button, applicationButtonList)
63 button->setEnabled(value);
67 void SelectionGroupBox::populate(
bool exclusive)
69 mButtonGroup->setExclusive(exclusive);
70 foreach(QString
string, mSelectionList)
75 string =
string.toLower();
76 string[0] =
string[0].toUpper();
78 QCheckBox* box =
new QCheckBox(
string);
79 mButtonGroup->addButton(box);
80 mLayout->addWidget(box);
84 connect(box, SIGNAL(clicked(
bool)),
this, SIGNAL(
userClicked()));
87 QHBoxLayout* hbox =
dynamic_cast<QHBoxLayout*
>(mLayout);
92 void SelectionGroupBox::filter(QStringList filter)
94 bool exclusive = mButtonGroup->exclusive();
96 mButtonGroup->setExclusive(
false);
97 QList<QAbstractButton*> applicationButtonList = mButtonGroup->buttons();
98 foreach(QAbstractButton* button, applicationButtonList)
100 bool on = filter.contains(button->text(), Qt::CaseInsensitive);
101 button->setChecked(on);
103 mButtonGroup->setExclusive(exclusive);