From a4384faf785bfda621c7daf8a6725af89ac18a1e Mon Sep 17 00:00:00 2001 From: baydam Date: Tue, 29 Dec 2015 10:34:52 +0000 Subject: [PATCH] Center the test signal #97 --- MainWindow.h | 1 - OutputGLCanvas.cpp | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/MainWindow.h b/MainWindow.h index 6989219..90d61f1 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -89,7 +89,6 @@ private slots: void openRecentFile(); void clearRecentFileList(); void openRecentVideo(); - //void quitMapMap(); // Edit menu. void deleteItem(); // Context menu for mappings. diff --git a/OutputGLCanvas.cpp b/OutputGLCanvas.cpp index 6690a24..d03fd50 100644 --- a/OutputGLCanvas.cpp +++ b/OutputGLCanvas.cpp @@ -89,8 +89,14 @@ void OutputGLCanvas::_drawTestSignal(QPainter* painter) } } + // Create responsive image + QImage test_signal = _svg_test_signal.scaled(geo.height(), geo.height(), Qt::KeepAspectRatio); + // Set new brush + this->_brush_test_signal = QBrush(test_signal); + // Center the brush + painter->translate((geo.width() - test_signal.width()) / 2, (geo.height() - test_signal.height()) / 2); // Draw the actual brush. - painter->fillRect(geo, this->_brush_test_signal); + painter->fillRect(0, 0, test_signal.width(), test_signal.height(), this->_brush_test_signal); } void OutputGLCanvas::resizeGL(int width, int height)