nodes: added ability to label nodes
This commit is contained in:
@@ -107,6 +107,9 @@ void Node::Save(QXmlStreamWriter *writer, const QString &custom_name) const
|
||||
QStringLiteral("%1:%2").arg(QString::number(GetPosition().x()),
|
||||
QString::number(GetPosition().y())));
|
||||
|
||||
writer->writeAttribute(QStringLiteral("label"),
|
||||
GetLabel());
|
||||
|
||||
foreach (NodeParam* param, parameters()) {
|
||||
param->Save(writer);
|
||||
}
|
||||
@@ -277,6 +280,20 @@ QList<NodeOutput *> Node::GetOutputs() const
|
||||
return {output_};
|
||||
}
|
||||
|
||||
const QString &Node::GetLabel() const
|
||||
{
|
||||
return label_;
|
||||
}
|
||||
|
||||
void Node::SetLabel(const QString &s)
|
||||
{
|
||||
if (label_ != s) {
|
||||
label_ = s;
|
||||
|
||||
emit LabelChanged(label_);
|
||||
}
|
||||
}
|
||||
|
||||
void Node::CopyInputs(Node *source, Node *destination, bool include_connections)
|
||||
{
|
||||
Q_ASSERT(source->id() == destination->id());
|
||||
@@ -295,6 +312,9 @@ void Node::CopyInputs(Node *source, Node *destination, bool include_connections)
|
||||
NodeInput::CopyValues(src, dst, include_connections);
|
||||
}
|
||||
}
|
||||
|
||||
destination->SetPosition(source->GetPosition());
|
||||
destination->SetLabel(source->GetLabel());
|
||||
}
|
||||
|
||||
bool Node::CanBeDeleted() const
|
||||
|
||||
@@ -359,6 +359,9 @@ public:
|
||||
|
||||
QList<NodeOutput*> GetOutputs() const;
|
||||
|
||||
const QString& GetLabel() const;
|
||||
void SetLabel(const QString& s);
|
||||
|
||||
protected:
|
||||
void AddInput(NodeInput* input);
|
||||
|
||||
@@ -396,6 +399,11 @@ signals:
|
||||
*/
|
||||
void PositionChanged(const QPointF& pos);
|
||||
|
||||
/**
|
||||
* @brief Signal emitted when SetLabel() is called
|
||||
*/
|
||||
void LabelChanged(const QString& s);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Add a parameter to this node
|
||||
@@ -431,6 +439,11 @@ private:
|
||||
*/
|
||||
QPointF position_;
|
||||
|
||||
/**
|
||||
* @brief Custom user label for node
|
||||
*/
|
||||
QString label_;
|
||||
|
||||
private slots:
|
||||
void InputChanged(const OLIVE_NAMESPACE::TimeRange &range);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user