aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-09-16 20:51:29 +0200
committerJulian T <julian@jtle.dk>2020-09-16 21:06:24 +0200
commita38e6014ea5441e9d29fcb3b5607cd94e4061cff (patch)
tree69811a8a52246117228f70909d6a95ec049ff86e
parent9b34ab6db773568011dc85fd73156b63da377e01 (diff)
Scaled to fit window
-rw-r--r--app/draw.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/draw.cpp b/app/draw.cpp
index 6cbc338..88733ef 100644
--- a/app/draw.cpp
+++ b/app/draw.cpp
@@ -1,4 +1,5 @@
#include "draw.hpp"
+#include <qnamespace.h>
#include <qpainter.h>
#include <qglobal.h>
#include <qimage.h>
@@ -12,11 +13,14 @@ DrawWidget::DrawWidget(const Config &conf) :
m_drawbuffer = new QRgb[conf.m_width * conf.m_height];
m_img = QImage((uchar*)m_drawbuffer, conf.m_width, conf.m_height, QImage::Format_ARGB32);
+
}
void DrawWidget::paintEvent(QPaintEvent*) {
QPainter painter(this);
- painter.drawImage(0, 0, m_img);
+
+ auto scaled = m_img.scaled(width(), height(), Qt::KeepAspectRatio);
+ painter.drawImage(0, 0, scaled);
}
void DrawWidget::redraw() {