52 lines
1005 B
C++
52 lines
1005 B
C++
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
#include <QPainter>
|
|
#include "sensor.h"
|
|
#include "hallsensor.h"
|
|
#include "schuifdeur.h"
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
QMainWindow(parent),
|
|
ui(new Ui::MainWindow){
|
|
ui->setupUi(this);
|
|
s1=new Sensor(515,160);
|
|
vd = new Schuifdeur(503,250,80);
|
|
}
|
|
|
|
MainWindow::~MainWindow(){
|
|
delete ui;
|
|
delete s1;
|
|
delete vd;
|
|
}
|
|
|
|
void MainWindow::paintEvent(QPaintEvent *event){
|
|
|
|
QPainter painter(this);
|
|
QPen pen;
|
|
QImage image("/home/shaquille/Downloads/gebouw/Gebouw.png");
|
|
|
|
pen.setColor(Qt::green);
|
|
pen.setWidth(4);
|
|
painter.setPen(pen);
|
|
painter.drawImage(10,10,image);
|
|
|
|
s1->teken(this);
|
|
vd->teken(this);
|
|
}
|
|
|
|
void MainWindow::on_schuifdeurSensorKnop_clicked(){
|
|
if(s1->isGeactiveerd())
|
|
s1->deactiveer();
|
|
else
|
|
s1->activeer();
|
|
update();
|
|
}
|
|
|
|
void MainWindow::on_vd_clicked(){
|
|
if(vd->isDeurOpen())
|
|
vd->sluit();
|
|
else
|
|
vd->open();
|
|
update();
|
|
}
|