33 lines
866 B
C++
33 lines
866 B
C++
#include "schuifdeur.h"
|
|
#include <QPaintDevice>
|
|
#include <QPainter>
|
|
#include <QPen>
|
|
#include "hallsensor.h"
|
|
#include "slot.h"
|
|
#include "iostream"
|
|
|
|
Schuifdeur::Schuifdeur(int x, int y, int lengte, Sensor *sensor): Deur(x,y,lengte), s(sensor){
|
|
|
|
}
|
|
|
|
|
|
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(){
|
|
if (!s->isGeactiveerd()){
|
|
Deur::sluit();
|
|
s->activeer();
|
|
}
|
|
}
|