QmlDesigner: Don't use a timer anymore in the drag tool

Change-Id: I5f8b8436815c871e462c888e9963c8ee754bbc72
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
Marco Bubke
2014-07-21 18:07:02 +02:00
parent 1c15b4f34c
commit ac7f17c28a
5 changed files with 10 additions and 26 deletions

View File

@@ -42,19 +42,11 @@
namespace QmlDesigner {
namespace Internal {
void TimerHandler::clearMoveDelay()
{
m_dragTool->clearMoveDelay();
}
}
DragTool::DragTool(FormEditorView *editorView)
: AbstractFormEditorTool(editorView),
m_moveManipulator(editorView->scene()->manipulatorLayerItem(), editorView),
m_selectionIndicator(editorView->scene()->manipulatorLayerItem()),
m_timerHandler(new Internal::TimerHandler(this)),
m_blockMove(false),
m_isAborted(false)
{
@@ -327,7 +319,6 @@ void DragTool::createDragNode(const QMimeData *mimeData, const QPointF &scenePos
m_blockMove = true;
m_startPoint = scenePosition;
QTimer::singleShot(10000, m_timerHandler.data(), SLOT(clearMoveDelay()));
}
}
}

View File

@@ -42,22 +42,6 @@ namespace QmlDesigner {
class DragTool;
namespace Internal {
class TimerHandler : public QObject
{
Q_OBJECT
public:
TimerHandler(DragTool *tool) : QObject(), m_dragTool(tool) {}
public slots:
void clearMoveDelay();
private:
DragTool *m_dragTool;
};
}
class DragTool : public AbstractFormEditorTool
{
public:
@@ -116,7 +100,6 @@ private:
QPointer<FormEditorItem> m_movingItem;
RewriterTransaction m_rewriterTransaction;
QmlItemNode m_dragNode;
QScopedPointer<Internal::TimerHandler> m_timerHandler;
bool m_blockMove;
QPointF m_startPoint;
bool m_isAborted;

View File

@@ -299,6 +299,12 @@ void FormEditorView::propertiesRemoved(const QList<AbstractProperty> &/*property
{
}
void FormEditorView::customNotification(const AbstractView */*view*/, const QString &identifier, const QList<ModelNode> &/*nodeList*/, const QList<QVariant> &/*data*/)
{
if (identifier == QStringLiteral("puppet crashed"))
m_dragTool->clearMoveDelay();
}
AbstractFormEditorTool* FormEditorView::currentTool() const
{
return m_currentTool;

View File

@@ -84,6 +84,8 @@ public:
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE;
void propertiesRemoved(const QList<AbstractProperty> &propertyList) QTC_OVERRIDE;
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) QTC_OVERRIDE;
// FormEditorView
WidgetInfo widgetInfo() QTC_OVERRIDE;

View File

@@ -188,6 +188,8 @@ void NodeInstanceView::handleChrash()
restartProcess();
else
emit qmlPuppetCrashed();
emitCustomNotification(QStringLiteral("puppet crashed"));
}