Skip to content
Snippets Groups Projects
Commit 94011a12 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.NodeInstanceView: introducing delay in setPathToQt()


We have to delayed the restart, because when creating a
new project we switch to that project before we open
the new file. This means the user can get an error about
a missing puppet, because the new project is based on another Qt version.

This is a hotfix for Qt Creator 2.7.

Task-number: QTCREATORBUG-8756
Change-Id: I8c74c6334dca35ad29771339855e777d307b9e43
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent d3aaa769
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,7 @@
#include <QWeakPointer>
#include <QRectF>
#include <QTime>
#include <QTimer>
QT_BEGIN_NAMESPACE
class QDeclarativeEngine;
......@@ -193,9 +194,11 @@ private: // functions
void resetVerticalAnchors(const ModelNode &node);
void restartProcess();
void restartProcessDelayed();
private slots:
void handleChrash();
void restartProcessDelayedTimeOut();
private: //variables
NodeInstance m_rootNodeInstance;
......@@ -210,6 +213,8 @@ private: //variables
QTime m_lastCrashTime;
NodeInstanceServerInterface::RunModus m_runModus;
QString m_pathToQt;
bool m_puppetRestarted;
QTimer m_singleShotTimerRestartProcessDelayed;
};
} // namespace ProxyNodeInstanceView
......
......@@ -35,6 +35,7 @@
#include <QGraphicsObject>
#include <QFileSystemWatcher>
#include <QMultiHash>
#include <QTimer>
#include <model.h>
#include <modelnode.h>
......@@ -110,9 +111,13 @@ d too.
NodeInstanceView::NodeInstanceView(QObject *parent, NodeInstanceServerInterface::RunModus runModus)
: AbstractView(parent),
m_baseStatePreviewImage(QSize(100, 100), QImage::Format_ARGB32),
m_runModus(runModus)
m_runModus(runModus),
m_puppetRestarted(false)
{
m_baseStatePreviewImage.fill(0xFFFFFF);
m_singleShotTimerRestartProcessDelayed.setSingleShot(true);
m_singleShotTimerRestartProcessDelayed.setInterval(400);
connect(&m_singleShotTimerRestartProcessDelayed, SIGNAL(timeout()), this, SLOT(restartProcessDelayedTimeOut()));
}
......@@ -197,10 +202,15 @@ void NodeInstanceView::handleChrash()
emit qmlPuppetCrashed();
}
void NodeInstanceView::restartProcessDelayedTimeOut()
{
if (!m_puppetRestarted)
restartProcess();
}
void NodeInstanceView::restartProcess()
{
m_puppetRestarted = true;
if (model()) {
delete nodeInstanceServer();
......@@ -218,6 +228,12 @@ void NodeInstanceView::restartProcess()
}
}
void NodeInstanceView::restartProcessDelayed()
{
m_puppetRestarted = false;
m_singleShotTimerRestartProcessDelayed.start();
}
void NodeInstanceView::nodeCreated(const ModelNode &createdNode)
{
NodeInstance instance = loadNode(createdNode);
......@@ -1123,7 +1139,16 @@ void NodeInstanceView::setPathToQt(const QString &pathToQt)
{
if (m_pathToQt != pathToQt) {
m_pathToQt = pathToQt;
restartProcess();
/* The restart is done delayed, because when creating a new project we switch to that project
* before we open the new file. This means the user can get an error about a missing puppet,
* because the new project is based on another Qt version.
*
* See QTCREATORBUG-8756 for more details.
*
*/
restartProcessDelayed();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment