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
|
#include <QApplication>
#include <QtGui>
#include<QPushButton>
#include<QFont>
#include<QBrush>
#include<QPalette>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget fenetre;
//fenetre.setGeometry(500,300,500,300);
fenetre.setFixedSize(500, 400);
//fenetre.setStyleSheet("background-color: graphe img.png");
QPalette pal = fenetre.palette() ;
QPixmap pix(QPixmap( "f.png" ) );
pal.setBrush( QPalette::Background, QBrush(pix) );
fenetre.setPalette(pal);
QPushButton *bouton = new QPushButton("SIMULATION DES ALGORITHMES DE PARCOURS DE GRAPHE",&fenetre);
bouton->setGeometry(400,50,400,50) ;
bouton->move(20,20);
bouton->setFont(QFont("Comic Sans MS", 10));
bouton->setCursor(Qt::PointingHandCursor);
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();
} |
Partager