图图图!!!
This commit is contained in:
1 parent
54ac81c2ce
commit
837030d0be
15 files changed
+504
-116
No files matched your search
+19
-12
@@ -2,29 +2,36 @@
|
||||
#include "ui_monitor.h"
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include "parkingLotItem.h"
|
||||
#include "parkingLotManager.h"
|
||||
|
||||
Monitor::Monitor(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::Monitor)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ParkingLotItem *pk = new ParkingLotItem(Q_NULLPTR, this);
|
||||
QObject::connect(ui->downStairButton, &QPushButton::clicked, pk, &ParkingLotItem::showDownStairFloor);
|
||||
QObject::connect(ui->upStairButton, &QPushButton::clicked, pk, &ParkingLotItem::showUpStairFloor);
|
||||
QObject::connect(pk, &ParkingLotItem::enableUpButton, ui->upStairButton, &QPushButton::setEnabled);
|
||||
QObject::connect(pk, &ParkingLotItem::enableDownButton, ui->downStairButton, &QPushButton::setEnabled);
|
||||
QObject::connect(pk, &ParkingLotItem::setCapacity, ui->capacity, &QLabel::setText);
|
||||
QObject::connect(pk, &ParkingLotItem::setLoad, ui->load, &QLabel::setText);
|
||||
QObject::connect(pk, &ParkingLotItem::setLayerName, ui->layerName, &QLabel::setText);
|
||||
|
||||
pk->showParkingLot();
|
||||
QGraphicsScene *scene = new QGraphicsScene(this); // 创建场景
|
||||
ParkingLotManager *pk = new ParkingLotManager(this, scene);
|
||||
QObject::connect(ui->downStairButton, &QPushButton::clicked, pk, &ParkingLotManager::showDownStairFloor);
|
||||
QObject::connect(ui->upStairButton, &QPushButton::clicked, pk, &ParkingLotManager::showUpStairFloor);
|
||||
QObject::connect(pk, &ParkingLotManager::enableUpButton, ui->upStairButton, &QPushButton::setEnabled);
|
||||
QObject::connect(pk, &ParkingLotManager::enableDownButton, ui->downStairButton, &QPushButton::setEnabled);
|
||||
QObject::connect(pk, &ParkingLotManager::setCapacity, ui->capacity, &QLabel::setText);
|
||||
QObject::connect(pk, &ParkingLotManager::setLoad, ui->load, &QLabel::setText);
|
||||
QObject::connect(pk, &ParkingLotManager::setLayerName, ui->layerName, &QLabel::setText);
|
||||
|
||||
QObject::connect(ui->drawPath, &QPushButton::clicked, [=](){
|
||||
pk->drawPath(ui->placeNum1->text().toUInt(), ui->placeNum2->text().toUInt());
|
||||
});
|
||||
pk->showParkingLot();
|
||||
ui->view->setScene(scene);
|
||||
scene->addItem(pk);
|
||||
// scene->addItem(pk);
|
||||
}
|
||||
|
||||
Monitor::~Monitor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user