2022-02-10 16:44:22 +00:00
|
|
|
#include "schuifdeur.h"
|
|
|
|
#include <QPaintDevice>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QPen>
|
2022-02-17 23:51:34 +00:00
|
|
|
#include "hallsensor.h"
|
2022-03-29 16:38:53 +00:00
|
|
|
#include "slot.h"
|
|
|
|
#include "iostream"
|
2022-02-10 16:44:22 +00:00
|
|
|
|
2022-02-17 23:51:34 +00:00
|
|
|
Schuifdeur::Schuifdeur(int x, int y, int lengte, Sensor *sensor): Deur(x,y,lengte), s(sensor){
|
2022-02-10 16:44:22 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-03-29 16:38:53 +00:00
|
|
|
|
2022-02-10 16:44:22 +00:00
|
|
|
void Schuifdeur::teken(QPaintDevice *tp){
|
|
|
|
QPainter p(tp);
|
|
|
|
QColor kleur=Qt::black;
|
|
|
|
p.setBrush(Qt::SolidPattern);
|
|
|
|
p.setBrush(kleur);
|
|
|
|
QPen pen(kleur,2,Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
|
|
p.setPen(pen);
|
|
|
|
if(isDeurOpen())
|
|
|
|
p.drawLine(coordinaten().first, coordinaten().second, coordinaten().first, coordinaten().second + deurLengte());
|
|
|
|
else
|
|
|
|
p.drawLine(coordinaten().first, coordinaten().second, coordinaten().first, coordinaten().second - deurLengte());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Schuifdeur::sluit(){
|
2022-02-17 23:51:34 +00:00
|
|
|
if (!s->isGeactiveerd()){
|
|
|
|
Deur::sluit();
|
|
|
|
s->activeer();
|
|
|
|
}
|
2022-02-10 16:44:22 +00:00
|
|
|
}
|