-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomboboxwidget.cpp
More file actions
43 lines (39 loc) · 909 Bytes
/
Copy pathcomboboxwidget.cpp
File metadata and controls
43 lines (39 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "comboboxwidget.h"
ComboBoxWidget::ComboBoxWidget(QStringList choices, QString title, QString comboBoxToolTip, QString buttonText, QString buttonToolTip, QWidget *parent)
: QWidget(parent)
{
setupUi(this);
setLabel(title);
setComboBox(choices, comboBoxToolTip);
setPushButton(buttonText, buttonToolTip);
}
void ComboBoxWidget::setLabel(QString text)
{
if ( text.isEmpty() )
label->hide();
else {
label->setText(text);
label->show();
}
}
void ComboBoxWidget::setPushButton(QString text, QString toolTip)
{
if ( text.isEmpty() )
pushButton->hide();
else {
pushButton->setText(text);
pushButton->setToolTip(toolTip);
pushButton->show();
}
}
void ComboBoxWidget::setComboBox(QStringList list, QString toolTip)
{
comboBox->clear();
if ( list.isEmpty() )
comboBox->hide();
else {
comboBox->insertItems(0, list);
comboBox->setToolTip(toolTip);
comboBox->show();
}
}