HAL
combobox_dialog.cpp
Go to the documentation of this file.
2 
3 #include <QDialogButtonBox>
4 
5 namespace hal
6 {
8  {
9  init();
10  }
11 
12  ComboboxDialog::ComboboxDialog(const QString windowTitle, const QString infoText, const QStringList entries, const QString defaultSelected, QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
13  {
14  init();
15 
17  setInfoText(infoText);
18  setItems(entries);
19  mCombobox->setCurrentText(defaultSelected);
20  }
21 
23  {
24  mCombobox->addItems(entries);
25  }
26 
28  {
29  mInfoLabel->setText(text);
30  }
31 
33  {
34  return mCombobox->currentText();
35  }
36 
38  {
39  return mCombobox->currentIndex();
40  }
41 
43  {
44  mInfoLabel = new QLabel();
45  mCombobox = new QComboBox();
46 
47 
49  mOkButton = button_box->button(QDialogButtonBox::Ok);
50 
51  mLayout = new QVBoxLayout(this);
54  mLayout->addWidget(button_box);
55 
56  mInfoLabel->setStyleSheet("font-weight: bold");
57  mInfoLabel->setContentsMargins(0, 0, 0, 15);
58 
59  mLayout->setContentsMargins(15,15,15,10);
60 
63  }
64 
66  {
68  }
69 
71  {
73 
74  }
75 
76 }
ComboboxDialog(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
void setInfoText(const QString text)
virtual void setItems(const QStringList entries)
QPushButton * mOkButton
QVBoxLayout * mLayout
QString textValue() const
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
void addItems(const QStringList &texts)
void setCurrentText(const QString &text)
virtual void done(int r)
QPushButton * button(QDialogButtonBox::StandardButton which) const const
void setText(const QString &)
void setContentsMargins(int left, int top, int right, int bottom)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
typedef WindowFlags
void setContentsMargins(int left, int top, int right, int bottom)
void setStyleSheet(const QString &styleSheet)
void setWindowTitle(const QString &)