1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| #include <QtGui/QApplication>
#include <QtGui>
#include <QLabel>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget fenetre;
QPushButton *bouton = new QPushButton("Ouvrir la fenêtre", &fenetre);
QDialog secondeFenetre (&fenetre);
QVBoxLayout *layout = new QVBoxLayout;
QLabel *image = new QLabel(&secondeFenetre);
image->setPixmap(QPixmap("icone.png"));
layout->addWidget(image);
secondeFenetre.setLayout(layout);
QWidget::connect(bouton, SIGNAL(clicked()), &secondeFenetre, SLOT(exec()));
fenetre.show();
return app.exec();
} |