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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
#include "fenaccueil.h"
FenAccueil::FenAccueil(QWidget *parent) :
QWidget(parent)
{
// Le Label de font
Label_FontAccueil = new QLabel;
Label_FontAccueil->setPixmap(QPixmap("D:/Prog QT/images/menu_principal.png"));
Label_FontAccueil->setAlignment(Qt::AlignCenter);
Label_FontAccueil->setMouseTracking(true);
Label_FontAccueil->setAcceptDrops(true);
// Les boutons
Button_Application = new QPushButton ("", Label_FontAccueil);
Button_Application->setCursor(Qt::PointingHandCursor);
Button_Application->setGeometry(30, 175, 340, 40);
Button_Application->setStyleSheet("QPushButton { border-radius: 10px; background-image: url(D:/Prog QT/images/bouton1.png); } QPushButton:hover { border-style: outset; border-color: grey; border-width: 1px; border-radius: 10px; } ");
Button_Serveur = new QPushButton ("", Label_FontAccueil);
Button_Serveur->setCursor(Qt::PointingHandCursor);
Button_Serveur->setGeometry(30, 216, 340, 40);
Button_Serveur->setStyleSheet("QPushButton { border-radius: 10px; background-image: url(D:/Prog QT/images/bouton2.png); } QPushButton:hover { border-style: outset; border-color: grey; border-width: 1px; border-radius: 10px; } ");
Button_JournalAlertes = new QPushButton("", Label_FontAccueil);
Button_JournalAlertes->setCursor(Qt::PointingHandCursor);
Button_JournalAlertes->setGeometry(30, 257, 340, 40);
Button_JournalAlertes->setStyleSheet("QPushButton { border-radius: 10px; background-image: url(D:/Prog QT/images/bouton3.png); } QPushButton:hover { border-style: outset; border-color: grey; border-width: 1px; border-radius: 10px; } ");
Button_Conversion = new QPushButton("", Label_FontAccueil);
Button_Conversion->setCursor(Qt::PointingHandCursor);
Button_Conversion->setGeometry(30, 298, 340, 40);
Button_Conversion->setStyleSheet("QPushButton { border-radius: 10px; background-image: url(D:/Prog QT/images/bouton4.png); } QPushButton:hover { border-style: outset; border-color: grey; border-width: 1px; border-radius: 10px; } ");
Button_Quitter = new QPushButton("", Label_FontAccueil);
Button_Quitter->setCursor(Qt::PointingHandCursor);
Button_Quitter->setGeometry(30, 339, 340, 40);
Button_Quitter->setStyleSheet("QPushButton { border-radius: 10px; background-image: url(D:/Prog QT/images/bouton5.png); } QPushButton:hover { border-style: outset; border-color: grey; border-width: 1px; border-radius: 10px; } ");
// MVC
ModeleMesuresRecentes = new QDirModel(Label_FontAccueil);
VueMesuresRecentes = new QListView(Label_FontAccueil);
VueMesuresRecentes->setModel(ModeleMesuresRecentes);
VueMesuresRecentes->setRootIndex(ModeleMesuresRecentes->index("D:/Prog QT/mesures"));
VueMesuresRecentes->setGeometry(50, 470, 303, 110);
VueMesuresRecentes->setStyleSheet("QListView { border: none; background-color: transparent; }");
// Les layouts
LayoutPrincipal = new QVBoxLayout;
LayoutPrincipal->addWidget(Label_FontAccueil);
LayoutPrincipal->setContentsMargins(0, 0, 0, 0);
setLayout(LayoutPrincipal);
// Fenetre Accueil
setWindowFlags(Qt::Widget | Qt::FramelessWindowHint | Qt::MSWindowsOwnDC);
setWindowTitle("Test");
setWindowIcon(QIcon("D:/Prog QT/images/flotteur.ico"));
setAttribute(Qt::WA_TranslucentBackground, true);
move ( QApplication::desktop()->screenGeometry().center() - rect().center() );
// Slots
QObject::connect(Button_Quitter, SIGNAL(clicked()), qApp, SLOT(quit()));
QObject::connect(Button_Application, SIGNAL(clicked()), this, SLOT(ouvrirApplication()));
}
void FenAccueil::mouseMoveEvent(QMouseEvent *event)
{
if (event->buttons() & Qt::LeftButton) {
move(event->globalPos() - dragPosition);
event->accept();
}
}
void FenAccueil::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
dragPosition = event->globalPos() - frameGeometry().topLeft();
event->accept();
}
}
void FenAccueil::ouvrirGmSoftApplication()
{
FenApplication * FApplication = new FenApplication;
FApplication->show();
close();
} |
Partager