From 9fd7152f13157f88136a386779919ce57ac59e2b Mon Sep 17 00:00:00 2001 From: Christian Daniel Date: Mon, 23 Sep 2013 21:31:54 +0200 Subject: major rewrite and changes... far too many to put into individual commits --- sdrbase/gui/channelwindow.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 sdrbase/gui/channelwindow.cpp (limited to 'sdrbase/gui/channelwindow.cpp') diff --git a/sdrbase/gui/channelwindow.cpp b/sdrbase/gui/channelwindow.cpp new file mode 100644 index 0000000..2849bf7 --- /dev/null +++ b/sdrbase/gui/channelwindow.cpp @@ -0,0 +1,36 @@ +#include +#include +#include +#include +#include "gui/channelwindow.h" +#include "gui/rollupwidget.h" + +ChannelWindow::ChannelWindow(QWidget* parent) : + QScrollArea(parent) +{ + m_container = new QWidget(this); + m_layout = new QBoxLayout(QBoxLayout::TopToBottom, m_container); + setWidget(m_container); + setWidgetResizable(true); + setBackgroundRole(QPalette::Base); + m_layout->setMargin(3); + m_layout->setSpacing(3); +} + +void ChannelWindow::addRollupWidget(QWidget* rollupWidget) +{ + rollupWidget->setParent(m_container); + m_container->layout()->addWidget(rollupWidget); +} + +void ChannelWindow::resizeEvent(QResizeEvent* event) +{ + if(event->size().height() > event->size().width()) { + m_layout->setDirection(QBoxLayout::TopToBottom); + m_layout->setAlignment(Qt::AlignTop); + } else { + m_layout->setDirection(QBoxLayout::LeftToRight); + m_layout->setAlignment(Qt::AlignLeft); + } + QScrollArea::resizeEvent(event); +} -- cgit v1.2.3