-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetdialog.cpp
More file actions
42 lines (33 loc) · 1.08 KB
/
Copy pathsetdialog.cpp
File metadata and controls
42 lines (33 loc) · 1.08 KB
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
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "setdialog.h"
SetDialog::SetDialog(const QString &lab, const QString &oldVal)
{
label = new QLabel(lab);
okButton = new QPushButton("OK");
cancelButton = new QPushButton("Cancel");
valText = new QLineEdit(oldVal);
valText->setFocus();
QGridLayout *gLayout = new QGridLayout;
gLayout->setColumnStretch(1, 2);
gLayout->addWidget(label, 0, 0);
gLayout->addWidget(valText, 0, 1);
QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->addWidget(cancelButton);
buttonLayout->addWidget(okButton);
gLayout->addLayout(buttonLayout, 2, 1, Qt::AlignRight);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(gLayout);
setLayout(mainLayout);
connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
setWindowTitle(tr("Set a new value"));
}
QString SetDialog::getValue()
{
return valText->text();
}