-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvueborne.cpp
More file actions
37 lines (32 loc) · 1.01 KB
/
vueborne.cpp
File metadata and controls
37 lines (32 loc) · 1.01 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
//
// Created by lucas on 20/05/2023.
//
#include "vueborne.h"
#include <QPainter>
#include <QString>
#include <QStaticText>
VueBorne::VueBorne(Borne &c, int nb_b, QWidget *parent) {
setBackgroundRole(QPalette::Base);
setAutoFillBackground(true);
setFixedSize(50,70);
connect(this,SIGNAL(clicked()),this,SLOT(clickedEvent()));
setCheckable(true);
nb_borne = nb_b;
}
VueBorne::VueBorne(int nb_b, QWidget *parent) {
setBackgroundRole(QPalette::Base);
setAutoFillBackground(true);
setFixedSize(50,70);
connect(this,SIGNAL(clicked()),this,SLOT(clickedEvent()));
setCheckable(false);
nb_borne = nb_b;
}
void VueBorne::paintEvent(QPaintEvent *event) {
QPainter painter(this);
if (borne==nullptr) {
painter.drawText(QRect(5,10,width(),10), Qt::AlignCenter, tr("vide"));
return;
}
setStyleSheet("color: gray;");
painter.drawText(QRect(5, 10, width(), 10), Qt::AlignCenter, tr((borne->getId() + " P : " + std::to_string(borne->GetPossesseur())).c_str()));
}