2023-08-13 22:12:38 +02:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
2023-08-15 00:09:29 +02:00
|
|
|
#include <QPainter>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QGraphicsPixmapItem>
|
|
|
|
#include <QGraphicsView>
|
|
|
|
|
2023-08-13 22:12:38 +02:00
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
|
|
: QMainWindow(parent)
|
|
|
|
, ui(new Ui::MainWindow)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2023-08-14 13:53:34 +02:00
|
|
|
this->server = new UdpLedServer ();
|
2023-08-15 00:09:29 +02:00
|
|
|
|
|
|
|
this->mOffscreenDiagram = new QImage(DEFAULT_WIDTH, DEFAULT_HEIGHT, QImage::Format_RGB32);
|
|
|
|
this->mOffscreenDiagram->fill(COLOR_BACKGROUND);
|
|
|
|
|
2023-08-13 22:12:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2023-08-15 00:09:29 +02:00
|
|
|
void MainWindow::drawImage(QImage *target) {
|
|
|
|
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->show();
|
|
|
|
this->ui->ledPanel->addWidget(graphicsView);
|
|
|
|
}
|
|
|
|
|