2 #include <QRadioButton> 3 #include <QAbstractButton> 8 #include "GuiListParameter.h" 12 GuiListParameter::GuiListParameter(QGridLayout *grid, UserInterface &ui,
13 int group,
int param) :
14 GuiParameter(grid, ui, group, param) {
17 p_label->setAlignment(Qt::AlignRight | Qt::AlignTop);
22 QVBoxLayout *lo =
new QVBoxLayout;
23 grid->addLayout(lo, param, 2);
27 p_buttonGroup =
new QButtonGroup();
31 for(
int item = 0; item < ui.ParamListSize(group, param); item++) {
32 QString btext = ui.ParamListBrief(group, param, item);
34 btext += ui.ParamListValue(group, param, item);
39 if((item == 0) && (p_ui->
HelpersSize(group, param) != 0)) {
41 QHBoxLayout *hlo =
new QHBoxLayout;
45 QRadioButton *rb =
new QRadioButton(btext);
47 p_buttonGroup->addButton(rb);
51 hlo->addWidget(helper);
57 QRadioButton *rb =
new QRadioButton(btext);
59 p_buttonGroup->addButton(rb);
63 connect(p_buttonGroup, SIGNAL(buttonClicked(QAbstractButton *)),
64 this, SIGNAL(ValueChanged()));
70 GuiListParameter::~GuiListParameter() {
75 void GuiListParameter::Set(QString newValue) {
76 QString value = newValue.toUpper();
78 int foundAtButton = -1;
79 for(
int i = 0; i < p_ui->
ParamListSize(p_group, p_param); i++) {
80 QString option = p_ui->
ParamListValue(p_group, p_param, i).toUpper();
82 if(option == value) foundAtButton = i;
85 if(foundAtButton != -1) {
86 p_buttonGroup->buttons()[foundAtButton]->setChecked(
true);
93 QString GuiListParameter::Value() {
94 if(p_buttonGroup->checkedButton() == 0) {
99 p_buttonGroup->buttons().indexOf(p_buttonGroup->checkedButton()));
103 std::vector<QString> list;
105 if(p_buttonGroup->checkedButton() == 0)
return list;
106 int index = p_buttonGroup->buttons().indexOf(p_buttonGroup->checkedButton());
virtual std::vector< QString > Exclusions()
Return list of current exclusions.
QWidget * AddHelpers(QObject *lo)
Sets up helper button.
int ParamListSize(const int &group, const int ¶m) const
Returns the number of options in the specified parameter's list.
int HelpersSize(const int &group, const int ¶m) const
Returns the number of helpers the parameter has.
int ParamListExcludeSize(const int &group, const int ¶m, const int &option) const
Returns the number of items in a parameters list exclude section.
QString ParamListExclude(const int &group, const int ¶m, const int &option, const int &exclude) const
Returns the parameter name to be excluded if this option is selected.
Namespace for ISIS/Bullet specific routines.
void RememberWidget(QWidget *w)
Add widgets to a list for enabling/disabling.
QString ParamListValue(const int &group, const int ¶m, const int &option) const
Returns the option value for a specific option to a parameter.