Simulation is working

This commit is contained in:
Ollo
2023-08-17 22:19:12 +02:00
parent c5bfaa2a4a
commit aac762e8f1
3 changed files with 13 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ MainWindow::MainWindow(QWidget *parent)
{
ui->setupUi(this);
this->mOffscreenPanel = new QImage(DEFAULT_WIDTH + LED_DISTANCE, DEFAULT_HEIGHT + LED_DISTANCE, QImage::Format_RGB32);
this->drawImage(this->mOffscreenPanel);
this->server = new UdpLedServer (NULL, this);
}
@@ -21,12 +22,10 @@ MainWindow::~MainWindow()
}
void MainWindow::drawImage(QImage *target) {
this->mScene=new QGraphicsScene() ;
QGraphicsView *graphicsView = new QGraphicsView();
graphicsView->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QGraphicsScene* scene=new QGraphicsScene() ;
graphicsView->setScene(scene);
QGraphicsPixmapItem* item = new QGraphicsPixmapItem(QPixmap::fromImage(*(target)));
scene->addItem(item);
graphicsView->setScene(this->mScene);
graphicsView->show();
this->ui->ledPanel->addWidget(graphicsView);
}
@@ -42,7 +41,10 @@ void MainWindow::setLED(uint8_t x, uint8_t y) {
}
void MainWindow::updatePanel(void) {
this->drawImage(this->mOffscreenPanel);
QGraphicsPixmapItem* item = new QGraphicsPixmapItem(QPixmap::fromImage(*(this->mOffscreenPanel)));
this->mScene->clear();
mScene->addItem(item);
this->renderPanel();
}