From 57bed56dcd9cfdfc599238025e13efe57db347d9 Mon Sep 17 00:00:00 2001 From: Albert S Date: Fri, 23 Aug 2019 23:42:56 +0200 Subject: [PATCH] window: add scrollarea for button grid --- window.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/window.cpp b/window.cpp index fc14693..4953f7f 100644 --- a/window.cpp +++ b/window.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "window.h" #include "configprovider.h" Window::Window(ConfigProvider &configProvider) @@ -93,14 +94,20 @@ QVector Window::generateEntryButtons(const QVectorsetAlignment(Qt::AlignTop); - vbox->addWidget(lineEdit); - vbox->addLayout(grid); - connect(lineEdit, &QLineEdit::textChanged, this, [this](QString newtext) { this->lineEditTextChanged(newtext); }); - connect(lineEdit, &QLineEdit::returnPressed, this, &Window::lineEditReturnPressed); + QVBoxLayout *vbox = new QVBoxLayout(this); + QScrollArea *sa = new QScrollArea; + grid = new QGridLayout(); + lineEdit = new QLineEdit(); + QWidget *w = new QWidget(this); + w->setLayout(grid); + sa->setWidget(w); + sa->setWidgetResizable(true); + vbox->setAlignment(Qt::AlignTop); + vbox->addWidget(lineEdit); + vbox->addWidget(sa); + + connect(lineEdit, &QLineEdit::textChanged, this, [this](QString newtext) { this->lineEditTextChanged(newtext); }); + connect(lineEdit, &QLineEdit::returnPressed, this, &Window::lineEditReturnPressed); } void Window::populateGrid(const QVector &list)