11#include "UserInterface.h"
13#include "GuiParameter.h"
14#include "GuiComboBoxParameter.h"
18 GuiComboBoxParameter::GuiComboBoxParameter(QGridLayout *grid, UserInterface &ui,
19 int group,
int param) :
20 GuiParameter(grid, ui, group, param) {
23 p_label->setAlignment(Qt::AlignRight | Qt::AlignTop);
27 QVBoxLayout *lo =
new QVBoxLayout;
28 grid->addLayout(lo, param, 2);
35 for(
int item = 0; item < ui.ParamListSize(group, param); item++) {
36 QString btext = ui.ParamListBrief(group, param, item);
38 btext += ui.ParamListValue(group, param, item);
40 p_combo->insertItem(item, btext);
42 lo->addWidget(p_combo);
43 connect(p_combo, SIGNAL(activated(
int)),
44 this, SIGNAL(ValueChanged()));
47 RememberWidget(p_combo);
51 GuiComboBoxParameter::~GuiComboBoxParameter() {
56 void GuiComboBoxParameter::Set(QString newValue) {
57 IString value = newValue;
60 int foundAtButton = -1;
61 for(
int i = 0; i < p_ui->ParamListSize(p_group, p_param); i++) {
62 IString option = p_ui->ParamListValue(p_group, p_param, i);
65 if(option == value) foundAtButton = i;
68 if(foundAtButton != -1) {
69 p_combo->setCurrentIndex(foundAtButton);
76 QString GuiComboBoxParameter::Value() {
77 return p_ui->ParamListValue(p_group, p_param,
78 p_combo->currentIndex());
81 std::vector<QString> GuiComboBoxParameter::Exclusions() {
82 std::vector<QString> list;
84 int index = p_combo->currentIndex();
86 for(
int i = 0; i < p_ui->ParamListExcludeSize(p_group, p_param, index); i++) {
87 QString s = p_ui->ParamListExclude(p_group, p_param, index, i);
94 void GuiComboBoxParameter::setOption (
int option) {
95 std::cout <<
"Combo box option: " << option << std::endl;
This is free and unencumbered software released into the public domain.