nodeparamview: span columns where possible
This commit is contained in:
@@ -40,6 +40,7 @@ const int NodeParamViewItemBody::kOptionalCheckBox = 0;
|
||||
const int NodeParamViewItemBody::kArrayCollapseBtnColumn = 1;
|
||||
const int NodeParamViewItemBody::kLabelColumn = 2;
|
||||
const int NodeParamViewItemBody::kWidgetStartColumn = 3;
|
||||
const int NodeParamViewItemBody::kMaxWidgetColumn = kKeyControlColumn;
|
||||
|
||||
#define super NodeParamViewItemBase
|
||||
|
||||
@@ -216,13 +217,6 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout* layout, Node *node, const
|
||||
// Place widgets into layout
|
||||
PlaceWidgetsFromBridge(layout, ui_objects.widget_bridge, row);
|
||||
|
||||
// Add widgets for this parameter to the layout
|
||||
for (int i=0; i<ui_objects.widget_bridge->widgets().size(); i++) {
|
||||
QWidget* w = ui_objects.widget_bridge->widgets().at(i);
|
||||
|
||||
layout->addWidget(w, row, i+kWidgetStartColumn);
|
||||
}
|
||||
|
||||
// In case this input is a group, resolve that actual input to use for connected labels
|
||||
NodeInput resolved = NodeGroup::ResolveInput(input_ref);
|
||||
|
||||
@@ -355,7 +349,17 @@ void NodeParamViewItemBody::PlaceWidgetsFromBridge(QGridLayout* layout, NodePara
|
||||
for (int i=0; i<bridge->widgets().size(); i++) {
|
||||
QWidget* w = bridge->widgets().at(i);
|
||||
|
||||
layout->addWidget(w, row, i+kWidgetStartColumn);
|
||||
int col = i+kWidgetStartColumn;
|
||||
|
||||
int colspan;
|
||||
if (i == bridge->widgets().size()-1) {
|
||||
// Span this widget among remaining columns
|
||||
colspan = kMaxWidgetColumn - col;
|
||||
} else {
|
||||
colspan = 1;
|
||||
}
|
||||
|
||||
layout->addWidget(w, row, col, 1, colspan);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,6 +134,7 @@ private:
|
||||
static const int kArrayCollapseBtnColumn;
|
||||
static const int kLabelColumn;
|
||||
static const int kWidgetStartColumn;
|
||||
static const int kMaxWidgetColumn;
|
||||
|
||||
private slots:
|
||||
void EdgeChanged(Node *output, const NodeInput &input);
|
||||
|
||||
Reference in New Issue
Block a user