summaryrefslogtreecommitdiffstats
path: root/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
diff options
context:
space:
mode:
authorAhmad Samir <[email protected]>2024-09-05 16:54:40 +0300
committerAhmad Samir <[email protected]>2024-10-03 23:03:30 +0300
commit07593900dcf30ce5d70bb8b6e731e316578afbbe (patch)
tree77bde9caf40ec953b6b0eb937e5d03a848c2df6c /examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
parentc07c414609eb028a0554e5a7f14dbb5531c614b4 (diff)
GraphWidget example: use QBasicTimer instead of raw timer IDs
Change-Id: I9ba66ff37112b749d29a9121f4c89cab1a8e9d07 Reviewed-by: Thiago Macieira <[email protected]>
Diffstat (limited to 'examples/widgets/graphicsview/elasticnodes/graphwidget.cpp')
-rw-r--r--examples/widgets/graphicsview/elasticnodes/graphwidget.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
index ede3d23137b..9e678c0b38a 100644
--- a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
+++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
@@ -74,8 +74,10 @@ GraphWidget::GraphWidget(QWidget *parent)
//! [2]
void GraphWidget::itemMoved()
{
- if (!timerId)
- timerId = startTimer(1000 / 25);
+ using namespace std::chrono_literals;
+
+ if (!timer.isActive())
+ timer.start(1000ms / 25, this);
}
//! [2]
@@ -132,10 +134,8 @@ void GraphWidget::timerEvent(QTimerEvent *event)
itemsMoved = true;
}
- if (!itemsMoved) {
- killTimer(timerId);
- timerId = 0;
- }
+ if (!itemsMoved)
+ timer.stop();
}
//! [4]