diff options
Diffstat (limited to 'tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark')
5 files changed, 18 insertions, 17 deletions
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp index eabe3671e5..0aa73b9e26 100644 --- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp +++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -27,7 +27,7 @@ ****************************************************************************/ #include <QDebug> -#include <QTime> +#include <QElapsedTimer> #include "itemrecyclinglist.h" #include "listitemcontainer.h" @@ -160,10 +160,10 @@ void ItemRecyclingList::themeChange() void ItemRecyclingList::keyPressEvent(QKeyEvent *event) { - static QTime keyPressInterval = QTime::currentTime(); + static QElapsedTimer keyPressInterval; static qreal step = 0.0; static bool repeat = false; - int interval = keyPressInterval.elapsed(); + int interval = keyPressInterval.isValid() ? keyPressInterval.elapsed() : 0; ScrollBar* sb = verticalScrollBar(); qreal currentValue = sb->sliderPosition(); diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp index 8f7736010d..93b8d86019 100644 --- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp +++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -132,7 +132,7 @@ qreal MainView::fps() void MainView::fpsReset() { m_frameCount = 0; - m_fpsFirstTs.start(); + m_fpsFirstTs = QTime::currentTime(); m_fpsLatestTs = m_fpsFirstTs; m_fpsUpdated.start(); } @@ -201,7 +201,7 @@ void MainView::paintEvent (QPaintEvent *event) emit repainted(); m_frameCount++; - m_fpsLatestTs.start(); + m_fpsLatestTs = QTime::currentTime(); if(m_fpsUpdated.elapsed() > 2000) { updateFps(); m_fpsUpdated.start(); diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h index d7fe404023..8237ff7469 100644 --- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h +++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -31,6 +31,7 @@ #include <QGraphicsView> #include <QTime> +#include <QElapsedTimer> #include <QTimer> #include "settings.h" @@ -100,7 +101,7 @@ private: QTime m_fpsFirstTs; QTime m_fpsLatestTs; bool m_OutputFps; - QTime m_fpsUpdated; + QElapsedTimer m_fpsUpdated; QList<qreal> m_Fpss; int m_angle; diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller_p.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller_p.h index cf11c7fa02..c8769f59b2 100644 --- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller_p.h +++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -42,7 +42,7 @@ #include <QPoint> #include <QTimer> -#include <QTime> +#include <QElapsedTimer> #include "scroller.h" @@ -70,8 +70,8 @@ public: QPoint m_cursorPos; QPointF m_speed; State m_state; - QTime m_lastCursorTime; - QTime m_lastFrameTime; + QElapsedTimer m_lastCursorTime; + QElapsedTimer m_lastFrameTime; QTimer m_scrollTimer; int m_scrollSlowAccum; diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp index 941cab8c21..d64f3ac38d 100644 --- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp +++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -29,7 +29,7 @@ #include <QDebug> #include <QGraphicsLinearLayout> #include <QFont> -#include <QTime> +#include <QElapsedTimer> #include "simplelist.h" static const int MinItemWidth = 276; @@ -99,10 +99,10 @@ void SimpleList::setListItemCaching(bool enable) void SimpleList::keyPressEvent(QKeyEvent *event) { - static QTime keyPressInterval = QTime::currentTime(); + static QElapsedTimer keyPressInterval; static qreal step = 0.0; static bool repeat = false; - int interval = keyPressInterval.elapsed(); + int interval = keyPressInterval.isValid() ? keyPressInterval.elapsed() : 0; ScrollBar* sb = verticalScrollBar(); qreal currentValue = sb->sliderPosition(); |