made node param view scrollable

This commit is contained in:
itsmattkc
2019-08-20 12:17:28 +10:00
parent c8dfd09acc
commit 8cce0c9e83
2 changed files with 23 additions and 7 deletions
+22 -6
View File
@@ -20,16 +20,32 @@
#include "nodeparamview.h"
#include <QScrollArea>
NodeParamView::NodeParamView(QWidget *parent) :
QWidget(parent)
{
// Set new layout
layout_ = new QVBoxLayout(this);
layout_->setSpacing(0);
layout_->setMargin(0);
// Create horizontal layout to place scroll area in (and keyframe editing eventually)
QHBoxLayout* widget_layout = new QHBoxLayout(this);
widget_layout->setSpacing(0);
widget_layout->setMargin(0);
// Set up scroll area for params
QScrollArea* scroll_area = new QScrollArea();
scroll_area->setWidgetResizable(true);
widget_layout->addWidget(scroll_area);
// Param widget
QWidget* param_widget_area = new QWidget();
scroll_area->setWidget(param_widget_area);
// Set up scroll area layout
param_layout_ = new QVBoxLayout(param_widget_area);
param_layout_->setSpacing(0);
param_layout_->setMargin(0);
// Add a stretch to allow empty space at the bottom of the layout
layout_->addStretch();
param_layout_->addStretch();
}
void NodeParamView::SetNodes(QList<Node *> nodes)
@@ -65,7 +81,7 @@ void NodeParamView::SetNodes(QList<Node *> nodes)
item->AttachNode(node);
// Insert the widget before the stretch
layout_->insertWidget(layout_->count() - 1, item);
param_layout_->insertWidget(param_layout_->count() - 1, item);
items_.append(item);
}
+1 -1
View File
@@ -36,7 +36,7 @@ public:
const QList<Node*>& nodes();
private:
QVBoxLayout* layout_;
QVBoxLayout* param_layout_;
QList<Node*> nodes_;