-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmydialog.h
49 lines (37 loc) · 1.13 KB
/
mydialog.h
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
44
45
46
47
48
49
#ifndef MYDIALOG_H
#define MYDIALOG_H
#include <QTextEdit>
#include <QLabel>
#include <QVBoxLayout>
#include <QPushButton>
class MyDialog : public QWidget
{
Q_OBJECT
public:
MyDialog()
{
QVBoxLayout* vBoxLayout = new QVBoxLayout(this);
vBoxLayout->setMargin(0);
vBoxLayout->setSpacing(0);
label = new QLabel(this);
label->setWordWrap(true);
vBoxLayout->addWidget(label);
QPushButton* okButton = new QPushButton(this);
okButton->setText(tr("Ok"));
okButton->setMinimumSize(100,60);
okButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QWidget* okButtonParentWidget = new QWidget(this);
QHBoxLayout* okButtonLayout = new QHBoxLayout(okButtonParentWidget);
okButtonLayout->setMargin(0); okButtonLayout->setSpacing(0);
okButtonLayout->addWidget(okButton);
vBoxLayout->addWidget(okButtonParentWidget);
connect(okButton, SIGNAL(clicked()), this, SLOT(hide()));
}
void setText( const QString& text )
{
label->setText( text );
}
private:
QLabel* label;
};
#endif // MYDIALOG_H