24 #include <QDialogButtonBox>
25 #include <QGridLayout>
28 #include <QPushButton>
29 #include <QVBoxLayout>
42 _providerSegmentName =
new QLineEdit(
this);
43 _entityName =
new QLineEdit(
this);
45 _buttonBox =
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
this);
48 new QLabel(
"Enter provider segment name and entity name for new entity:");
49 QFont font = instruction->font();
51 instruction->setFont(font);
54 QGridLayout* grid =
new QGridLayout();
57 grid->addWidget(
new QLabel(
"Core Segment ID"), 0, col);
58 grid->addWidget(
new QLabel(QString::fromStdString(coreSegmentID.
str()) +
"/"), 1, col);
61 grid->addWidget(
new QLabel(
"Provider Segment Name"), 0, col);
62 grid->addWidget(_providerSegmentName, 1, col);
65 grid->addWidget(
new QLabel(
"/"), 1, col);
68 grid->addWidget(
new QLabel(
"Entity Name"), 0, col);
69 grid->addWidget(_entityName, 1, col);
73 QVBoxLayout* layout =
new QVBoxLayout();
75 layout->addWidget(instruction);
76 layout->addLayout(grid);
77 layout->addWidget(_buttonBox);
80 connect(_buttonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept);
81 connect(_buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject);
83 auto enableOkIfReady = [
this]()
85 _buttonBox->button(QDialogButtonBox::Ok)
86 ->setEnabled(_providerSegmentName->text().size() > 0 and
87 _entityName->text().size() > 0);
89 connect(_providerSegmentName, &QLineEdit::textChanged,
this, enableOkIfReady);
90 connect(_entityName, &QLineEdit::textChanged,
this, enableOkIfReady);
104 return _providerSegmentName->text();
111 return _entityName->text();