Implement FlowLayout for frame_mapTools

This commit is contained in:
BigBahss
2020-10-20 15:02:06 -04:00
parent bb61dc9b51
commit f449f370a0
2 changed files with 156 additions and 118 deletions

View File

@@ -13,6 +13,7 @@
#include "adjustingstackedwidget.h"
#include "draggablepixmapitem.h"
#include "editcommands.h"
#include "flowlayout.h"
#include <QFileDialog>
#include <QDirIterator>
@@ -135,6 +136,19 @@ void MainWindow::initCustomUI() {
connect(labelCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){
stack->setCurrentIndex(index);
});
// Convert the layout of the map tools' frame into an adjustable FlowLayout
FlowLayout *flowLayout = new FlowLayout;
flowLayout->setContentsMargins(ui->frame_mapTools->layout()->contentsMargins());
flowLayout->setSpacing(ui->frame_mapTools->layout()->spacing());
for (auto *child : ui->frame_mapTools->findChildren<QWidget *>(QString(), Qt::FindDirectChildrenOnly)) {
flowLayout->addWidget(child);
child->setFixedHeight(
ui->frame_mapTools->height() - flowLayout->contentsMargins().top() - flowLayout->contentsMargins().bottom()
);
}
delete ui->frame_mapTools->layout();
ui->frame_mapTools->setLayout(flowLayout);
}
void MainWindow::initExtraSignals() {