26 #include <QDialogButtonBox>
27 #include <QGridLayout>
36 QString
const& labelName,
const QRegExp& regExp, QWidget* parent) : QDialog(parent)
39 this->setWindowTitle(windowTitle);
40 QDialogButtonBox* buttonBox =
new QDialogButtonBox(
this);
41 buttonBox->setObjectName(QString::fromUtf8(
"buttonBox"));
42 buttonBox->setOrientation(Qt::Horizontal);
43 buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
44 edit =
new QLineEdit();
45 edit->setValidator(
new QRegExpValidator(regExp));
46 QGridLayout* layout =
new QGridLayout(
this);
47 this->setLayout(layout);
48 layout->addWidget(
new QLabel(labelName), 0, 0);
49 layout->addWidget(edit, 0, 1);
50 layout->addWidget(buttonBox, 1, 0, 1, 2);
51 connect(buttonBox, SIGNAL(accepted()),
this, SLOT(accept()));
52 connect(buttonBox, SIGNAL(rejected()),
this, SLOT(reject()));
53 resize(250, height());