aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-12-05 14:37:56 +0100
committerlonkaars <loek@pipeframe.xyz>2022-12-05 14:37:56 +0100
commit0a506540dad3a6b2de43917734efb58b2ccc1e0a (patch)
tree15eb972cb298c1d0ad6e5610db1b460ae13e2e9b
parent8739a4b47fbc6c2ab50e96e36f0df5581e82d8b6 (diff)
scroll container working
-rw-r--r--confui/ui_tab_node_overview.cpp47
-rw-r--r--confui/ui_tab_node_overview.h1
2 files changed, 26 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() {
+
+}
diff --git a/confui/ui_tab_node_overview.h b/confui/ui_tab_node_overview.h
index 954237d..ec5713c 100644
--- a/confui/ui_tab_node_overview.h
+++ b/confui/ui_tab_node_overview.h
@@ -12,4 +12,5 @@ public:
CDNodeOverviewTabWidget(CDMainWindow *main_window = nullptr);
virtual ~CDNodeOverviewTabWidget();
+ virtual void update();
};