28 #include <QRadioButton> 29 #include <QPushButton> 30 #include <QButtonGroup> 31 #include <QGridLayout> 32 #include <QHBoxLayout> 33 #include <QVBoxLayout> 41 int GuiInputAttribute::GetAttributes(
const QString &defaultAttribute,
42 QString &newAttribute,
50 p_dialog->setWindowTitle(title);
53 p_dialog->SetAttributes(defaultAttribute);
54 if(p_dialog->exec() == QDialog::Accepted) {
55 newAttribute = p_dialog->GetAttributes();
58 newAttribute = defaultAttribute;
65 QRadioButton *allBands =
new QRadioButton(
"&All Bands");
66 allBands->setToolTip(
"Select all bands from the input cube");
68 QRadioButton *listBands =
new QRadioButton(
"&Band List");
69 listBands->setToolTip(
"Select any bands from the input cube");
72 p_buttonGroup =
new QButtonGroup();
73 p_buttonGroup->addButton(allBands);
74 p_buttonGroup->addButton(listBands);
75 p_buttonGroup->setExclusive(
true);
78 p_lineEdit =
new QLineEdit();
79 connect(allBands, SIGNAL(toggled(
bool)), p_lineEdit, SLOT(setDisabled(
bool)));
80 allBands->setChecked(
true);
83 QGridLayout *gridLayout =
new QGridLayout();
84 gridLayout->addWidget(allBands, 0, 0);
85 gridLayout->addWidget(listBands, 1, 0);
86 gridLayout->addWidget(p_lineEdit, 1, 1);
89 QPushButton *okButton =
new QPushButton(
"Ok");
90 connect(okButton, SIGNAL(clicked()),
this, SLOT(accept()));
92 QPushButton *cancelButton =
new QPushButton(
"Cancel");
93 connect(cancelButton, SIGNAL(clicked()),
this, SLOT(reject()));
97 QButtonGroup *actionGroup =
new QButtonGroup();
98 actionGroup->addButton(okButton);
99 actionGroup->addButton(cancelButton);
103 QHBoxLayout *actionLayout =
new QHBoxLayout();
104 actionLayout->addWidget(okButton);
105 actionLayout->addWidget(cancelButton);
108 QVBoxLayout *dialogLayout =
new QVBoxLayout(
this);
109 dialogLayout->addLayout(gridLayout);
110 dialogLayout->addLayout(actionLayout);
115 GuiInputAttribute::~GuiInputAttribute() {}
119 QString GuiInputAttribute::GetAttributes() {
121 if(p_lineEdit->isEnabled()) {
122 attStr = p_lineEdit->text().simplified();
123 attStr = attStr.remove(QRegExp(
"^[+]*"));
124 if (attStr.length() > 0) {
125 if (attStr.left(1) !=
"+") attStr.prepend(
'+');
133 void GuiInputAttribute::SetAttributes(
const QString &value) {
135 std::vector<QString> bands = att.bands();
136 if(bands.size() == 0) {
137 p_buttonGroup->buttons()[0]->setChecked(
true);
138 p_lineEdit->setText(
"");
141 p_buttonGroup->buttons()[1]->setChecked(
true);
142 p_lineEdit->setText(att.toString());
Namespace for ISIS/Bullet specific routines.