SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
channelwindow.cpp
Go to the documentation of this file.
1 #include <QBoxLayout>
2 #include <QSpacerItem>
3 #include <QPainter>
4 #include <QResizeEvent>
5 #include "gui/channelwindow.h"
6 #include "gui/rollupwidget.h"
7 
8 ChannelWindow::ChannelWindow(QWidget* parent) :
9  QScrollArea(parent)
10 {
11  m_container = new QWidget(this);
12  m_layout = new QBoxLayout(QBoxLayout::TopToBottom, m_container);
13  setWidget(m_container);
14  setWidgetResizable(true);
15  setBackgroundRole(QPalette::Base);
16  m_layout->setMargin(3);
17  m_layout->setSpacing(3);
18 }
19 
20 void ChannelWindow::addRollupWidget(QWidget* rollupWidget)
21 {
22  rollupWidget->setParent(m_container);
23  m_container->layout()->addWidget(rollupWidget);
24 }
25 
26 void ChannelWindow::resizeEvent(QResizeEvent* event)
27 {
28  if(event->size().height() > event->size().width()) {
29  m_layout->setDirection(QBoxLayout::TopToBottom);
30  m_layout->setAlignment(Qt::AlignTop);
31  } else {
32  m_layout->setDirection(QBoxLayout::LeftToRight);
33  m_layout->setAlignment(Qt::AlignLeft);
34  }
35  QScrollArea::resizeEvent(event);
36 }
QWidget * m_container
Definition: channelwindow.h:21
void addRollupWidget(QWidget *rollupWidget)
QBoxLayout * m_layout
Definition: channelwindow.h:22
ChannelWindow(QWidget *parent=NULL)
void resizeEvent(QResizeEvent *event)