Fix perf issues zoomed in again
This commit is contained in:
parent
69d9a9e3f1
commit
5fa5a63d1a
3 changed files with 26 additions and 6 deletions
|
|
@ -352,12 +352,11 @@ void WarpGraphModel::refreshFromClient() {
|
|||
return;
|
||||
}
|
||||
|
||||
Q_EMIT beginBatchUpdate();
|
||||
m_refreshing = true;
|
||||
bool sceneChanged = false;
|
||||
auto nodesResult = m_client->ListNodes();
|
||||
if (!nodesResult.ok()) {
|
||||
m_refreshing = false;
|
||||
Q_EMIT endBatchUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -512,6 +511,10 @@ void WarpGraphModel::refreshFromClient() {
|
|||
m_volumeStates[qtId] = {};
|
||||
}
|
||||
|
||||
if (!sceneChanged) {
|
||||
sceneChanged = true;
|
||||
Q_EMIT beginBatchUpdate();
|
||||
}
|
||||
Q_EMIT nodeCreated(qtId);
|
||||
}
|
||||
|
||||
|
|
@ -526,6 +529,10 @@ void WarpGraphModel::refreshFromClient() {
|
|||
if (it == m_pwToQt.end()) {
|
||||
continue;
|
||||
}
|
||||
if (!sceneChanged) {
|
||||
sceneChanged = true;
|
||||
Q_EMIT beginBatchUpdate();
|
||||
}
|
||||
QtNodes::NodeId qtId = it->second;
|
||||
auto nodeIt = m_nodes.find(qtId);
|
||||
if (nodeIt == m_nodes.end()) {
|
||||
|
|
@ -581,6 +588,10 @@ void WarpGraphModel::refreshFromClient() {
|
|||
QtNodes::ConnectionId connId{outNodeIt->second, outPortIdx,
|
||||
inNodeIt->second, inPortIdx};
|
||||
if (m_connections.find(connId) == m_connections.end()) {
|
||||
if (!sceneChanged) {
|
||||
sceneChanged = true;
|
||||
Q_EMIT beginBatchUpdate();
|
||||
}
|
||||
m_connections.insert(connId);
|
||||
m_linkIdToConn.emplace(link.id.value, connId);
|
||||
Q_EMIT connectionCreated(connId);
|
||||
|
|
@ -609,6 +620,10 @@ void WarpGraphModel::refreshFromClient() {
|
|||
{
|
||||
auto connIt = m_connections.find(connId);
|
||||
if (connIt != m_connections.end()) {
|
||||
if (!sceneChanged) {
|
||||
sceneChanged = true;
|
||||
Q_EMIT beginBatchUpdate();
|
||||
}
|
||||
m_connections.erase(connIt);
|
||||
Q_EMIT connectionDeleted(connId);
|
||||
}
|
||||
|
|
@ -696,7 +711,9 @@ void WarpGraphModel::refreshFromClient() {
|
|||
}
|
||||
|
||||
m_refreshing = false;
|
||||
Q_EMIT endBatchUpdate();
|
||||
if (sceneChanged) {
|
||||
Q_EMIT endBatchUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
const WarpNodeData *
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
#include <QScrollBar>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include <QtNodes/internal/ConnectionGraphicsObject.hpp>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
class ZoomGraphicsView : public QtNodes::GraphicsView {
|
||||
|
|
@ -39,7 +41,8 @@ public:
|
|||
auto cacheMode = highZoom ? QGraphicsItem::DeviceCoordinateCache
|
||||
: QGraphicsItem::NoCache;
|
||||
for (QGraphicsItem *item : scene()->items()) {
|
||||
if (item->type() == QGraphicsProxyWidget::Type)
|
||||
if (item->type() == QGraphicsProxyWidget::Type ||
|
||||
item->type() == QtNodes::ConnectionGraphicsObject::Type)
|
||||
item->setCacheMode(cacheMode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue