This repository was archived by the owner on Nov 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaFenetre.cpp
More file actions
63 lines (55 loc) · 1.99 KB
/
MaFenetre.cpp
File metadata and controls
63 lines (55 loc) · 1.99 KB
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
#include "MaFenetre.h"
#include "jeu.h"
#include <fstream>
#include <iostream>
using namespace std;
MaFenetre::MaFenetre() : QWidget()
{
// construction fenetre
setGeometry(335,140,1250, 800);
// construction image
QLabel *image = new QLabel(this);
QPixmap *img = new QPixmap(QCoreApplication::applicationDirPath()+"/image/echec.jpg");
image->setPixmap(*img);
image->setGeometry(335,160,580,326);
// construction texte
titre = new QLabel(QString("Prototype Echéquier avec Qt"),this);
titre->setGeometry((1250 - 700)/2,50,700,100);
// Construction du bouton
b_commencer = new QPushButton("Commencer une nouvelle partie", this);
b_commencer->setGeometry(375,530,500,50);
b_charger = new QPushButton("Charger une ancienne partie", this);
b_charger->setGeometry(375,600,500,50);
b_quitter = new QPushButton("quitter le jeu", this);
b_quitter->setGeometry(375,670,500,50);
setstyle();
titre->setStyleSheet("font-size : 56px;");
QObject::connect(b_quitter, SIGNAL(clicked()), this, SLOT(confirm()));
QObject::connect(b_commencer, SIGNAL(clicked()), this, SLOT(lancement_jeu()));
}
void MaFenetre::setstyle()
{
/*string css;
ifstream stylefont(QCoreApplication::applicationDirPath()+"/image/styleFont"); //Ouverture d'un fichier en lecture
if(stylefont .is_open()){qDebug() <<"fichier ouvert"; getline(stylefont,css); stylefont.close();cout<<css;}else{
qDebug() <<"erreur ouverture fichier";
}*/
setStyleSheet("background-color: rgb(66,66,66);"
"color : white;"
"font-family : Bitstream Charter;"
"font-size : 20px;");
//setStyleSheet(css);
}
void MaFenetre::confirm()
{
int rep = QMessageBox::question(this, "Quitter", "Êtes vous sur de fermer le programme ?", QMessageBox::Yes | QMessageBox::No);
if (rep == QMessageBox::Yes){
qApp->quit();
}
}
void MaFenetre::lancement_jeu()
{
newjeu = new Jeu;
newjeu->show();
this->hide();
}