Commit 71df9a61 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.nodeInstanceView: further optimizes import changes

This patch delays the restart of the pupped by 200ms when an import changes.
parent 34846ac4
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <QSet> #include <QSet>
#include <QWeakPointer> #include <QWeakPointer>
#include <QRectF> #include <QRectF>
#include <QTimer>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QDeclarativeEngine; class QDeclarativeEngine;
...@@ -164,6 +165,7 @@ private: // functions ...@@ -164,6 +165,7 @@ private: // functions
private slots: private slots:
void restartProcess(); void restartProcess();
void restartProcessDelayed();
private: //variables private: //variables
NodeInstance m_rootNodeInstance; NodeInstance m_rootNodeInstance;
...@@ -174,6 +176,7 @@ private: //variables ...@@ -174,6 +176,7 @@ private: //variables
uint m_blockUpdates; uint m_blockUpdates;
QWeakPointer<NodeInstanceServerInterface> m_nodeInstanceServer; QWeakPointer<NodeInstanceServerInterface> m_nodeInstanceServer;
QTimer m_resetTimer;
}; };
} // namespace ProxyNodeInstanceView } // namespace ProxyNodeInstanceView
......
...@@ -111,6 +111,9 @@ d too. ...@@ -111,6 +111,9 @@ d too.
NodeInstanceView::NodeInstanceView(QObject *parent) NodeInstanceView::NodeInstanceView(QObject *parent)
: AbstractView(parent) : AbstractView(parent)
{ {
m_resetTimer.setInterval(200);
m_resetTimer.setSingleShot(true);
connect(&m_resetTimer, SIGNAL(timeout()), this, SLOT(restartProcessDelayed()));
} }
...@@ -170,6 +173,11 @@ void NodeInstanceView::restartProcess() ...@@ -170,6 +173,11 @@ void NodeInstanceView::restartProcess()
setBlockUpdates(false); setBlockUpdates(false);
} }
void NodeInstanceView::restartProcessDelayed()
{
m_resetTimer.start();
}
/*! \brief Notifing the view that a node was created. /*! \brief Notifing the view that a node was created.
A NodeInstance will be created for the new created ModelNode. A NodeInstance will be created for the new created ModelNode.
\param createdNode New created ModelNode. \param createdNode New created ModelNode.
...@@ -437,12 +445,12 @@ void NodeInstanceView::instancesCompleted(const QVector<ModelNode> &/*completedN ...@@ -437,12 +445,12 @@ void NodeInstanceView::instancesCompleted(const QVector<ModelNode> &/*completedN
void NodeInstanceView::importAdded(const Import &import) void NodeInstanceView::importAdded(const Import &import)
{ {
restartProcess(); restartProcessDelayed();
} }
void NodeInstanceView::importRemoved(const Import &/*import*/) void NodeInstanceView::importRemoved(const Import &/*import*/)
{ {
restartProcess(); restartProcessDelayed();
} }
//\} //\}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment