-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
35 lines (30 loc) · 868 Bytes
/
main.cpp
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
#include <QtGui>
#include "main.hpp"
MainDialog::MainDialog(QWidget* parent):QDialog(parent)
{
label = new QLabel(tr("<h1>Hello Qt!</h1>") );
setButton = new QPushButton(tr("set") );
lineEdit = new QLineEdit;
connect(setButton, SIGNAL(clicked()), this, SLOT(setLabelText()) );
QHBoxLayout* layout = new QHBoxLayout;
QVBoxLayout* mainLayout = new QVBoxLayout;
layout->addWidget(lineEdit);
layout->addWidget(setButton);
mainLayout->addWidget(label);
mainLayout->addLayout(layout);
setLayout(mainLayout);
}
void MainDialog::setLabelText()
{
QString text = lineEdit->text();
label->setText(text);
}
int main(int argc, char** argv)
{
QApplication app(argc, argv);
MainDialog* dialog = new MainDialog;
//dialog->resize(200, 50);
dialog->move(100, 50);
dialog->show();
return app.exec();
}