nodeparamview: improved node value tree size policy
This commit is contained in:
@@ -39,6 +39,11 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
|
|||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
|
|
||||||
|
QSizePolicy p = sizePolicy();
|
||||||
|
p.setHorizontalStretch(1);
|
||||||
|
p.setHorizontalPolicy(QSizePolicy::Expanding);
|
||||||
|
setSizePolicy(p);
|
||||||
|
|
||||||
// Set up label area
|
// Set up label area
|
||||||
QHBoxLayout *label_layout = new QHBoxLayout();
|
QHBoxLayout *label_layout = new QHBoxLayout();
|
||||||
label_layout->setSpacing(QtUtils::QFontMetricsWidth(fontMetrics(), QStringLiteral(" ")));
|
label_layout->setSpacing(QtUtils::QFontMetricsWidth(fontMetrics(), QStringLiteral(" ")));
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout* layout, Node *node, const
|
|||||||
// Create clickable label used when an input is connected
|
// Create clickable label used when an input is connected
|
||||||
ui_objects.connected_label = new NodeParamViewConnectedLabel(input_ref);
|
ui_objects.connected_label = new NodeParamViewConnectedLabel(input_ref);
|
||||||
connect(ui_objects.connected_label, &NodeParamViewConnectedLabel::RequestSelectNode, this, &NodeParamViewItemBody::RequestSelectNode);
|
connect(ui_objects.connected_label, &NodeParamViewConnectedLabel::RequestSelectNode, this, &NodeParamViewItemBody::RequestSelectNode);
|
||||||
layout->addWidget(ui_objects.connected_label, row, kWidgetStartColumn);
|
layout->addWidget(ui_objects.connected_label, row, kWidgetStartColumn, 1, kKeyControlColumn - kWidgetStartColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add keyframe control to this layout if parameter is keyframable
|
// Add keyframe control to this layout if parameter is keyframable
|
||||||
@@ -445,6 +445,10 @@ void NodeParamViewItemBody::UpdateUIForEdgeConnection(const NodeInput& input)
|
|||||||
|
|
||||||
// Show/hide connection label
|
// Show/hide connection label
|
||||||
ui_objects.connected_label->setVisible(input.IsConnected());
|
ui_objects.connected_label->setVisible(input.IsConnected());
|
||||||
|
|
||||||
|
if (ui_objects.key_control) {
|
||||||
|
ui_objects.key_control->setVisible(!input.IsConnected());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ NodeValueTree::NodeValueTree(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
setColumnWidth(0, 0);
|
setColumnWidth(0, 0);
|
||||||
setColumnCount(4);
|
setColumnCount(4);
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
||||||
|
QSizePolicy p = sizePolicy();
|
||||||
|
p.setHorizontalStretch(1);
|
||||||
|
setSizePolicy(p);
|
||||||
|
|
||||||
static const int kMinimumRows = 10;
|
static const int kMinimumRows = 10;
|
||||||
setMinimumHeight(fontMetrics().height() * kMinimumRows);
|
setMinimumHeight(fontMetrics().height() * kMinimumRows);
|
||||||
|
|||||||
Reference in New Issue
Block a user