window: add scrollarea for button grid

这个提交包含在:
Albert S. 2019-08-23 23:42:56 +02:00
父节点 69cc2710c3
当前提交 57bed56dcd

查看文件

@ -26,6 +26,7 @@
#include <QDebug> #include <QDebug>
#include <QMenu> #include <QMenu>
#include <QClipboard> #include <QClipboard>
#include <QScrollArea>
#include "window.h" #include "window.h"
#include "configprovider.h" #include "configprovider.h"
Window::Window(ConfigProvider &configProvider) Window::Window(ConfigProvider &configProvider)
@ -94,11 +95,17 @@ QVector<EntryPushButton*> Window::generateEntryButtons(const QVector<EntryConfig
void Window::createGui() void Window::createGui()
{ {
QVBoxLayout *vbox = new QVBoxLayout(this); QVBoxLayout *vbox = new QVBoxLayout(this);
QScrollArea *sa = new QScrollArea;
grid = new QGridLayout(); grid = new QGridLayout();
lineEdit = new QLineEdit(); lineEdit = new QLineEdit();
QWidget *w = new QWidget(this);
w->setLayout(grid);
sa->setWidget(w);
sa->setWidgetResizable(true);
vbox->setAlignment(Qt::AlignTop); vbox->setAlignment(Qt::AlignTop);
vbox->addWidget(lineEdit); vbox->addWidget(lineEdit);
vbox->addLayout(grid); vbox->addWidget(sa);
connect(lineEdit, &QLineEdit::textChanged, this, [this](QString newtext) { this->lineEditTextChanged(newtext); }); connect(lineEdit, &QLineEdit::textChanged, this, [this](QString newtext) { this->lineEditTextChanged(newtext); });
connect(lineEdit, &QLineEdit::returnPressed, this, &Window::lineEditReturnPressed); connect(lineEdit, &QLineEdit::returnPressed, this, &Window::lineEditReturnPressed);
} }