ModelingLib: Use QElapsedTimer instead of QTime

... because of recent deprecation of QTime::elapsed.

Change-Id: I5bb8cd2a613a0258669055471008c5d6b4db1099
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
hjk
2019-06-12 09:45:13 +02:00
parent ee68a4e7b4
commit 5ac71e485a
2 changed files with 6 additions and 7 deletions

View File

@@ -173,14 +173,13 @@ void ModelTreeView::dragMoveEvent(QDragMoveEvent *event)
if (dynamic_cast<MObject*>(modelElement)) if (dynamic_cast<MObject*>(modelElement))
accept = true; accept = true;
if (m_autoDelayIndex == dropIndex) { if (m_autoDelayIndex == dropIndex) {
if (m_autoDelayStartTime.elapsed() > 1000) { if (m_autoDelayStartTimer.elapsed() > 1000) {
setExpanded(dropIndex, !isExpanded(dropIndex)); setExpanded(dropIndex, !isExpanded(dropIndex));
m_autoDelayStartTime.start(); m_autoDelayStartTimer.start();
} }
} else { } else {
m_autoDelayIndex = dropIndex; m_autoDelayIndex = dropIndex;
m_autoDelayStartTime = QTime::currentTime(); m_autoDelayStartTimer.start();
m_autoDelayStartTime.start();
} }
} }
event->setAccepted(accept); event->setAccepted(accept);

View File

@@ -25,11 +25,11 @@
#pragma once #pragma once
#include <QTreeView>
#include "qmt/infrastructure/qmt_global.h" #include "qmt/infrastructure/qmt_global.h"
#include "qmt/model_ui/modeltreeviewinterface.h" #include "qmt/model_ui/modeltreeviewinterface.h"
#include <QTime> #include <QElapsedTimer>
#include <QTreeView>
namespace qmt { namespace qmt {
@@ -70,7 +70,7 @@ private:
SortedTreeModel *m_sortedTreeModel = nullptr; SortedTreeModel *m_sortedTreeModel = nullptr;
IElementTasks *m_elementTasks = nullptr; IElementTasks *m_elementTasks = nullptr;
QModelIndex m_autoDelayIndex; QModelIndex m_autoDelayIndex;
QTime m_autoDelayStartTime; QElapsedTimer m_autoDelayStartTimer;
}; };
} // namespace qmt } // namespace qmt