diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-12-05 14:37:56 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-12-05 14:37:56 +0100 |
commit | 0a506540dad3a6b2de43917734efb58b2ccc1e0a (patch) | |
tree | 15eb972cb298c1d0ad6e5610db1b460ae13e2e9b /confui/ui_tab_node_overview.cpp | |
parent | 8739a4b47fbc6c2ab50e96e36f0df5581e82d8b6 (diff) |
scroll container working
Diffstat (limited to 'confui/ui_tab_node_overview.cpp')
-rw-r--r-- | confui/ui_tab_node_overview.cpp | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/confui/ui_tab_node_overview.cpp b/confui/ui_tab_node_overview.cpp index 4dd2007..b60085c 100644 --- a/confui/ui_tab_node_overview.cpp +++ b/confui/ui_tab_node_overview.cpp @@ -1,6 +1,7 @@ #include <QWidget> #include <QLabel> #include <QVBoxLayout> +#include <QScrollArea> #include "ui_tab_node_overview.h" #include "ui_node.h" @@ -27,29 +28,31 @@ CDNodeOverviewTabWidget::CDNodeOverviewTabWidget(CDMainWindow* main_window) : QW this->mainwindow = main_window; QVBoxLayout* main_layout = new QVBoxLayout; + QScrollArea* scroll_area = new QScrollArea; + QWidget* scroll_container = new QWidget; + QVBoxLayout* scroll_inner = new QVBoxLayout; - const char* n_name = "berta"; - cd_s_node n = { - .address = { 0x00, 0xff, 0x21, 0x69, 0xf2, 0x31 }, - .name_len = strlen(n_name), - .name = n_name, - .light_on = true, - .provisioned = true, - }; - - cd_s_automation a = { - .type = CD_AUTOMATION_TYPE_TOGGLE, - .button = &n, - .light = &n, - }; - - CDNodeWidget* nd_w = new CDNodeWidget(&n, this); - CDAutomationWidget* au_w = new CDAutomationWidget(&a, this); - CDAddAutomationWidget* ad_w = new CDAddAutomationWidget(this); - - main_layout->addWidget(nd_w); - main_layout->addWidget(au_w); - main_layout->addWidget(ad_w); + 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::MinimumExpanding); + scroll_container->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); + scroll_container->setLayout(scroll_inner); + + vector<cd_s_node*> nodes = this->mainwindow->mesh_connector->get_nodes(); + CDNodeWidget* nd_w = new CDNodeWidget(nodes[0], this); + + scroll_inner->addWidget(nd_w); + + main_layout->addWidget(scroll_area); + + update(); setLayout(main_layout); } + +void CDNodeOverviewTabWidget::update() { + +} |