diff options
author | Julian T <julian@jtle.dk> | 2020-09-16 20:51:29 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-09-16 21:06:24 +0200 |
commit | a38e6014ea5441e9d29fcb3b5607cd94e4061cff (patch) | |
tree | 69811a8a52246117228f70909d6a95ec049ff86e /app | |
parent | 9b34ab6db773568011dc85fd73156b63da377e01 (diff) |
Scaled to fit window
Diffstat (limited to 'app')
-rw-r--r-- | app/draw.cpp | 6 |
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() { |