From 3f128e6555ca2605d29ab7d0868b2f5c3bdf968d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 14 Sep 2022 10:14:29 +0200 Subject: Make resizing a little less bad --- src/mainwindow.cpp | 8 ++++++++ src/mainwindow.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 83b999e..2d09504 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -16,6 +16,7 @@ MainWindow::MainWindow() : QDialog() inputLabel->setFont(f); outputLabel->setFont(f); cardLabel->setFont(f); + _originalSize = this->size(); } MainWindow::~MainWindow() @@ -122,6 +123,9 @@ void MainWindow::insertItemWidget(SlxOutput* w, bool isDevice) void MainWindow::mark() { setUpdatesEnabled(false); + this->resize(_originalSize); + outputLabel->setMinimumWidth(0); + inputLabel->setMinimumWidth(0); for (auto *w : _widgets) { w->unused = true; } @@ -142,4 +146,8 @@ void MainWindow::sweep() } } setUpdatesEnabled(true); + int width = qMax(outputLabel->width(), inputLabel->width()); + this->resize(_originalSize); + outputLabel->setMinimumWidth(width); + inputLabel->setMinimumWidth(width); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 5eede3f..cd9f5cb 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -3,6 +3,7 @@ #include #include +#include #include "ui_mainwindow.h" @@ -33,6 +34,7 @@ public: private: QMap _widgets; + QSize _originalSize; }; #endif -- cgit v1.2.3-55-g7522