8 #include <QRadioButton>
9 #include <QAbstractButton>
12 #include "UserInterface.h"
14 #include "GuiListParameter.h"
18 GuiListParameter::GuiListParameter(QGridLayout *grid, UserInterface &ui,
19 int group,
int param) :
20 GuiParameter(grid, ui, group, param) {
23 p_label->setAlignment(Qt::AlignRight | Qt::AlignTop);
28 QVBoxLayout *lo =
new QVBoxLayout;
29 grid->addLayout(lo, param, 2);
33 p_buttonGroup =
new QButtonGroup();
37 for(
int item = 0; item < ui.ParamListSize(group, param); item++) {
38 QString btext = ui.ParamListBrief(group, param, item);
40 btext += ui.ParamListValue(group, param, item);
45 if((item == 0) && (p_ui->
HelpersSize(group, param) != 0)) {
47 QHBoxLayout *hlo =
new QHBoxLayout;
51 QRadioButton *rb =
new QRadioButton(btext);
53 p_buttonGroup->addButton(rb);
57 hlo->addWidget(helper);
63 QRadioButton *rb =
new QRadioButton(btext);
65 p_buttonGroup->addButton(rb);
69 connect(p_buttonGroup, SIGNAL(buttonClicked(QAbstractButton *)),
70 this, SIGNAL(ValueChanged()));
76 GuiListParameter::~GuiListParameter() {
81 void GuiListParameter::Set(QString newValue) {
82 QString value = newValue.toUpper();
84 int foundAtButton = -1;
85 for(
int i = 0; i < p_ui->
ParamListSize(p_group, p_param); i++) {
86 QString option = p_ui->
ParamListValue(p_group, p_param, i).toUpper();
88 if(option == value) foundAtButton = i;
91 if(foundAtButton != -1) {
92 p_buttonGroup->buttons()[foundAtButton]->setChecked(
true);
99 QString GuiListParameter::Value() {
100 if(p_buttonGroup->checkedButton() == 0) {
105 p_buttonGroup->buttons().indexOf(p_buttonGroup->checkedButton()));
109 std::vector<QString> list;
111 if(p_buttonGroup->checkedButton() == 0)
return list;
112 int index = p_buttonGroup->buttons().indexOf(p_buttonGroup->checkedButton());