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
| # include <QApplication>
# include <QString>
# include <QPushButton>
# include <QLabel>
# include <QVBoxLayout>
# include <QWidget>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QPushButton *quit = new QPushButton("Hello world");
QLabel *label = new QLabel("Label");
QVBoxLayout *layout = new QVBoxLayout();
QWidget *widget = new QWidget();
quit->resize(300, 40);
//quit->setFont(QFont("Arial", 18, QFont::Bold));
//QObject::connect(quit, SIGNAL(clicked()), &app, SLOT(quit()));
QObject::connect(quit, SIGNAL(clicked()), label, SLOT(setText(QString("test"))));
layout->addWidget(quit);
layout->addWidget(label);
widget->setLayout(layout);
widget->show();
return app.exec();
} |
Partager