-
Notifications
You must be signed in to change notification settings - Fork 942
Open
Description
Your idea
If used dataUpdated Q_SIGNAL, nodes take data step by step. (node1 taken, node1 calculated, node1 updated, ... , nodeN taken, nodeN calculated, nodeN updated)
This is a problem and it's causing poor performance. Because each node wait before node.
`
void MyNode::onSendData(const QVector &data)
{
_data= std::make_shared<Data>();
_data->data= data;
emit dataUpdated(0); // node1 -> node2 -> ... -> nodeN
}
`
Problem to be solved
I tried solve the problem with QtConcurrent.
`
void MyNode::onSendData(const QVector &data, std::shared_ptrQtNodes::DataFlowGraphModel &graphModel, QtNodes::NodeId &id)
{
_data= std::make_shared<Data>();
_data->data= data;
auto conns = graphModel->connections(id, QtNodes::PortType::Out, 0);
QList<QtNodes::ConnectionId> connList(conns.begin(), conns.end());
QtConcurrent::map(connList, [&](const QtNodes::ConnectionId &conn) {
auto *node = graphModel->delegateModel<QtNodes::NodeDelegateModel>(conn.inNodeId);
if (node)
node->setInData(_data, conn.inPortIndex);
}).waitForFinished();
}
`
Prior art
No response
Additional context
I use QtConcurrent but I am not sure, is it the solution? I listen your all advices.
Checklist
- I have verified that this feature request has not been logged before, by searching the issue tracker for similar requests
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels