From 9477437256c8b34d0bf124c07abf7e08690dd824 Mon Sep 17 00:00:00 2001 From: Vladimir Svyatski Date: Thu, 20 Apr 2017 16:56:54 +0300 Subject: [PATCH] :bug: Fix for the issue #108: Add a scrollbar in the AddEntry window when on "small" screen --- src/gui/EditWidget.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gui/EditWidget.cpp b/src/gui/EditWidget.cpp index 24cc64fec..a0144c8cb 100644 --- a/src/gui/EditWidget.cpp +++ b/src/gui/EditWidget.cpp @@ -17,6 +17,7 @@ #include "EditWidget.h" #include "ui_EditWidget.h" +#include #include "core/FilePath.h" @@ -47,7 +48,17 @@ EditWidget::~EditWidget() void EditWidget::addPage(const QString& labelText, const QIcon& icon, QWidget* widget) { - m_ui->stackedWidget->addWidget(widget); + /* + * Instead of just adding a widget we're going to wrap it into a scroll area. It will automatically show + * scrollbars when the widget cannot fit into the page. This approach prevents the main window of the application + * from automatic resizing and it now should be able to fit into a user's monitor even if the monitor is only 768 + * pixels high. + */ + QScrollArea* scrollArea = new QScrollArea(m_ui->stackedWidget); + scrollArea->setFrameShape(QFrame::NoFrame); + scrollArea->setWidget(widget); + scrollArea->setWidgetResizable(true); + m_ui->stackedWidget->addWidget(scrollArea); m_ui->categoryList->addCategory(labelText, icon); }