aboutsummaryrefslogtreecommitdiff
path: root/confui/ui_scroll_container.cpp
blob: 6b1522166eab405b4cafc36a78c860822d3183a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "ui_scroll_container.h"

CDScrollContainerLayout::~CDScrollContainerLayout() { }
CDScrollContainerLayout::CDScrollContainerLayout(QWidget *parent) : QVBoxLayout(parent) {
	scroll_area = new QScrollArea;
	scroll_container = new QWidget;
	scroll_inner = new QVBoxLayout;

	scroll_area->setWidgetResizable(true);
	scroll_area->setFrameShape(QFrame::NoFrame);
	scroll_area->setBackgroundRole(QPalette::Window);
	scroll_area->setFrameShadow(QFrame::Plain);
	scroll_area->setWidget(scroll_container);
	scroll_area->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
	scroll_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	scroll_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
	scroll_container->setLayout(scroll_inner);

	QVBoxLayout::addWidget(scroll_area);
}

void CDScrollContainerLayout::addWidget(QWidget* widget) {
	scroll_inner->addWidget(widget);
}

void CDScrollContainerLayout::removeWidget(QWidget* widget) {
	scroll_inner->removeWidget(widget);
}