2020-09-08 10:47:20 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2020-09-19 19:06:34 -04:00
|
|
|
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
2020-09-08 10:47:20 -04:00
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2020-09-19 19:06:34 -04:00
|
|
|
#include <QPainter>
|
|
|
|
#include <QResizeEvent>
|
|
|
|
|
|
|
|
#include "featurewindow.h"
|
|
|
|
#include "rollupwidget.h"
|
|
|
|
|
|
|
|
FeatureWindow::FeatureWindow(QWidget* parent) :
|
2022-03-18 13:07:52 -04:00
|
|
|
QScrollArea(parent)
|
2020-09-19 19:06:34 -04:00
|
|
|
{
|
2022-03-18 13:07:52 -04:00
|
|
|
m_container = new QWidget(this);
|
|
|
|
m_container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
m_splitter = new QSplitter();
|
|
|
|
m_layout = new FeatureLayout(m_container, 3, 3, 3);
|
|
|
|
setWidget(m_container);
|
|
|
|
setWidgetResizable(true);
|
|
|
|
setBackgroundRole(QPalette::Base);
|
|
|
|
m_layout->addWidget(m_splitter); // Splitter must be added first
|
2020-09-08 10:47:20 -04:00
|
|
|
}
|
|
|
|
|
2020-09-19 19:06:34 -04:00
|
|
|
void FeatureWindow::addRollupWidget(QWidget* rollupWidget)
|
|
|
|
{
|
2022-03-18 13:07:52 -04:00
|
|
|
if (rollupWidget->sizePolicy().verticalPolicy() == QSizePolicy::Expanding)
|
|
|
|
{
|
|
|
|
rollupWidget->setParent(m_splitter);
|
|
|
|
m_splitter->addWidget(rollupWidget);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rollupWidget->setParent(m_container);
|
|
|
|
m_layout->addWidget(rollupWidget);
|
|
|
|
}
|
2020-09-19 19:06:34 -04:00
|
|
|
}
|
2020-09-08 10:47:20 -04:00
|
|
|
|
2020-09-19 19:06:34 -04:00
|
|
|
void FeatureWindow::resizeEvent(QResizeEvent* event)
|
|
|
|
{
|
2022-03-18 13:07:52 -04:00
|
|
|
if (event->size().height() > event->size().width())
|
|
|
|
{
|
|
|
|
m_layout->setOrientation(Qt::Vertical);
|
|
|
|
m_splitter->setOrientation(Qt::Vertical);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_layout->setOrientation(Qt::Horizontal);
|
|
|
|
m_splitter->setOrientation(Qt::Horizontal);
|
|
|
|
}
|
|
|
|
QScrollArea::resizeEvent(event);
|
2020-09-19 19:06:34 -04:00
|
|
|
}
|