LED framebuffer connected to GUI
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QGraphicsView>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->server = new UdpLedServer ();
|
||||
|
||||
this->mOffscreenDiagram = new QImage(DEFAULT_WIDTH, DEFAULT_HEIGHT, QImage::Format_RGB32);
|
||||
this->mOffscreenDiagram->fill(COLOR_BACKGROUND);
|
||||
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -14,3 +23,14 @@ MainWindow::~MainWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user