From 34e4a8ef6d20e829a322bfef1d09136a37fecfd2 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 7 Dec 2018 12:01:42 +0100 Subject: Cleanup Widgets examples - foreach Cleanup the Widgets examples - replace foreach with range-based for loop in the remaining directories Change-Id: I321e6c0f414401a1ae4fb65762b97d894b725afa Reviewed-by: Paul Wicking Reviewed-by: Luca Beldi --- examples/widgets/animation/stickman/animation.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'examples/widgets/animation/stickman/animation.cpp') diff --git a/examples/widgets/animation/stickman/animation.cpp b/examples/widgets/animation/stickman/animation.cpp index 94a92749bc..5c2d1682af 100644 --- a/examples/widgets/animation/stickman/animation.cpp +++ b/examples/widgets/animation/stickman/animation.cpp @@ -159,18 +159,16 @@ void Animation::save(QIODevice *device) const QDataStream stream(device); stream << m_name; stream << m_frames.size(); - foreach (Frame *frame, m_frames) { + for (const Frame *frame : qAsConst(m_frames)) { stream << frame->nodeCount(); - for (int i=0; inodeCount(); ++i) + for (int i = 0; i < frame->nodeCount(); ++i) stream << frame->nodePos(i); } } void Animation::load(QIODevice *device) { - if (!m_frames.isEmpty()) - qDeleteAll(m_frames); - + qDeleteAll(m_frames); m_frames.clear(); QDataStream stream(device); -- cgit v1.2.3