Replace QTime with QElapsedTimer in benchmarks
Various benchmarks were still using the deprecated timing API. One didn't even *use* the timer it implemented this way. One was just using start as a short-hand for assigning to currentTime(). Change-Id: If406d0fb606e454fec056f386bcd0aa6726ee96e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
13873c6bc6
commit
7202df3689
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
#include <QtCore/QProcess>
|
#include <QtCore/QProcess>
|
||||||
|
#include <QtCore/QElapsedTimer>
|
||||||
|
|
||||||
class tst_QProcess : public QObject
|
class tst_QProcess : public QObject
|
||||||
{
|
{
|
||||||
@ -50,7 +51,7 @@ void tst_QProcess::echoTest_performance()
|
|||||||
|
|
||||||
QVERIFY(process.waitForStarted());
|
QVERIFY(process.waitForStarted());
|
||||||
|
|
||||||
QTime stopWatch;
|
QElapsedTimer stopWatch;
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
|
|
||||||
qint64 totalBytes = 0;
|
qint64 totalBytes = 0;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -29,6 +29,7 @@
|
|||||||
#include <qtest.h>
|
#include <qtest.h>
|
||||||
|
|
||||||
#include <QtCore/qmath.h>
|
#include <QtCore/qmath.h>
|
||||||
|
#include <QtCore/QElapsedTimer>
|
||||||
#include <QtWidgets/QWidget>
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
#include "benchmarktests.h"
|
#include "benchmarktests.h"
|
||||||
@ -44,7 +45,7 @@ public:
|
|||||||
qreal result() const { return m_result; }
|
qreal result() const { return m_result; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QTime timer;
|
QElapsedTimer timer;
|
||||||
|
|
||||||
Benchmark *m_benchmark;
|
Benchmark *m_benchmark;
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ void BenchWidget::paintEvent(QPaintEvent *)
|
|||||||
|
|
||||||
++m_iteration;
|
++m_iteration;
|
||||||
|
|
||||||
uint currentElapsed = timer.isNull() ? 0 : timer.elapsed();
|
uint currentElapsed = timer.isValid() ? timer.elapsed() : 0;
|
||||||
timer.restart();
|
timer.restart();
|
||||||
|
|
||||||
m_total += currentElapsed;
|
m_total += currentElapsed;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -32,6 +32,7 @@
|
|||||||
#include <QtNetwork/qnetworkrequest.h>
|
#include <QtNetwork/qnetworkrequest.h>
|
||||||
#include <QtNetwork/qnetworkaccessmanager.h>
|
#include <QtNetwork/qnetworkaccessmanager.h>
|
||||||
#include <QtCore/QTemporaryFile>
|
#include <QtCore/QTemporaryFile>
|
||||||
|
#include <QtCore/QElapsedTimer>
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
|
|
||||||
class qfile_vs_qnetworkaccessmanager : public QObject
|
class qfile_vs_qnetworkaccessmanager : public QObject
|
||||||
@ -88,7 +89,7 @@ void qfile_vs_qnetworkaccessmanager::qnamFileRead_iteration(QNetworkAccessManage
|
|||||||
void qfile_vs_qnetworkaccessmanager::qnamFileRead()
|
void qfile_vs_qnetworkaccessmanager::qnamFileRead()
|
||||||
{
|
{
|
||||||
QNetworkAccessManager manager;
|
QNetworkAccessManager manager;
|
||||||
QTime t;
|
QElapsedTimer t;
|
||||||
QNetworkRequest request(QUrl::fromLocalFile(testFile.fileName()));
|
QNetworkRequest request(QUrl::fromLocalFile(testFile.fileName()));
|
||||||
|
|
||||||
// do 3 dry runs for cache warmup
|
// do 3 dry runs for cache warmup
|
||||||
@ -121,7 +122,7 @@ void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead_iteration(QNetworkAcc
|
|||||||
void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead()
|
void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead()
|
||||||
{
|
{
|
||||||
QNetworkAccessManager manager;
|
QNetworkAccessManager manager;
|
||||||
QTime t;
|
QElapsedTimer t;
|
||||||
QNetworkRequest request(QUrl::fromLocalFile(testFile.fileName()));
|
QNetworkRequest request(QUrl::fromLocalFile(testFile.fileName()));
|
||||||
|
|
||||||
// do 3 dry runs for cache warmup
|
// do 3 dry runs for cache warmup
|
||||||
@ -151,7 +152,7 @@ void qfile_vs_qnetworkaccessmanager::qfileFileRead_iteration()
|
|||||||
|
|
||||||
void qfile_vs_qnetworkaccessmanager::qfileFileRead()
|
void qfile_vs_qnetworkaccessmanager::qfileFileRead()
|
||||||
{
|
{
|
||||||
QTime t;
|
QElapsedTimer t;
|
||||||
|
|
||||||
// do 3 dry runs for cache warmup
|
// do 3 dry runs for cache warmup
|
||||||
qfileFileRead_iteration();
|
qfileFileRead_iteration();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -31,6 +31,7 @@
|
|||||||
#include <qtest.h>
|
#include <qtest.h>
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
#include <QtCore/qrandom.h>
|
#include <QtCore/qrandom.h>
|
||||||
|
#include <QtCore/QElapsedTimer>
|
||||||
#include <QtNetwork/qnetworkreply.h>
|
#include <QtNetwork/qnetworkreply.h>
|
||||||
#include <QtNetwork/qnetworkrequest.h>
|
#include <QtNetwork/qnetworkrequest.h>
|
||||||
#include <QtNetwork/qnetworkaccessmanager.h>
|
#include <QtNetwork/qnetworkaccessmanager.h>
|
||||||
@ -93,7 +94,7 @@ protected:
|
|||||||
QEventLoop eventLoop;
|
QEventLoop eventLoop;
|
||||||
QTimer::singleShot(timeout, &eventLoop, SLOT(quit()));
|
QTimer::singleShot(timeout, &eventLoop, SLOT(quit()));
|
||||||
|
|
||||||
QTime timer;
|
QElapsedTimer timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
eventLoop.exec();
|
eventLoop.exec();
|
||||||
disconnect(client, SIGNAL(bytesWritten(qint64)), this, 0);
|
disconnect(client, SIGNAL(bytesWritten(qint64)), this, 0);
|
||||||
@ -187,7 +188,7 @@ protected:
|
|||||||
DataReader reader(client, false);
|
DataReader reader(client, false);
|
||||||
QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit()));
|
QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit()));
|
||||||
|
|
||||||
QTime timer;
|
QElapsedTimer timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
eventLoop.exec();
|
eventLoop.exec();
|
||||||
qint64 elapsed = timer.elapsed();
|
qint64 elapsed = timer.elapsed();
|
||||||
@ -280,7 +281,7 @@ protected:
|
|||||||
DataReader reader(client, false);
|
DataReader reader(client, false);
|
||||||
QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit()));
|
QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit()));
|
||||||
|
|
||||||
QTime timer;
|
QElapsedTimer timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
eventLoop.exec();
|
eventLoop.exec();
|
||||||
qint64 elapsed = timer.elapsed();
|
qint64 elapsed = timer.elapsed();
|
||||||
@ -639,7 +640,7 @@ void tst_qnetworkreply::downloadPerformance()
|
|||||||
QNetworkReplyPtr reply(manager.get(request));
|
QNetworkReplyPtr reply(manager.get(request));
|
||||||
DataReader reader(reply, false);
|
DataReader reader(reply, false);
|
||||||
|
|
||||||
QTime loopTime;
|
QElapsedTimer loopTime;
|
||||||
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||||
loopTime.start();
|
loopTime.start();
|
||||||
QTestEventLoop::instance().enterLoop(40);
|
QTestEventLoop::instance().enterLoop(40);
|
||||||
@ -682,7 +683,7 @@ void tst_qnetworkreply::httpUploadPerformance()
|
|||||||
|
|
||||||
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||||
|
|
||||||
QTime time;
|
QElapsedTimer time;
|
||||||
generator.start();
|
generator.start();
|
||||||
time.start();
|
time.start();
|
||||||
QTestEventLoop::instance().enterLoop(40);
|
QTestEventLoop::instance().enterLoop(40);
|
||||||
@ -710,7 +711,7 @@ void tst_qnetworkreply::performanceControlRate()
|
|||||||
sink.connectToHost("127.0.0.1", sender.serverPort());
|
sink.connectToHost("127.0.0.1", sender.serverPort());
|
||||||
DataReader reader(&sink, false);
|
DataReader reader(&sink, false);
|
||||||
|
|
||||||
QTime loopTime;
|
QElapsedTimer loopTime;
|
||||||
connect(&sink, SIGNAL(disconnected()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
connect(&sink, SIGNAL(disconnected()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||||
loopTime.start();
|
loopTime.start();
|
||||||
QTestEventLoop::instance().enterLoop(40);
|
QTestEventLoop::instance().enterLoop(40);
|
||||||
@ -748,7 +749,7 @@ void tst_qnetworkreply::httpDownloadPerformance()
|
|||||||
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
|
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
|
||||||
HttpDownloadPerformanceClient client(reply.data());
|
HttpDownloadPerformanceClient client(reply.data());
|
||||||
|
|
||||||
QTime time;
|
QElapsedTimer time;
|
||||||
time.start();
|
time.start();
|
||||||
QTestEventLoop::instance().enterLoop(40);
|
QTestEventLoop::instance().enterLoop(40);
|
||||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -27,6 +27,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
#include <QtCore/QElapsedTimer>
|
||||||
#include <qglobal.h>
|
#include <qglobal.h>
|
||||||
#include <qcoreapplication.h>
|
#include <qcoreapplication.h>
|
||||||
#include <qtcpsocket.h>
|
#include <qtcpsocket.h>
|
||||||
@ -129,7 +130,7 @@ void tst_QTcpServer::ipv4LoopbackPerformanceTest()
|
|||||||
QVERIFY(clientB);
|
QVERIFY(clientB);
|
||||||
|
|
||||||
QByteArray buffer(16384, '@');
|
QByteArray buffer(16384, '@');
|
||||||
QTime stopWatch;
|
QElapsedTimer stopWatch;
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
qlonglong totalWritten = 0;
|
qlonglong totalWritten = 0;
|
||||||
while (stopWatch.elapsed() < 5000) {
|
while (stopWatch.elapsed() < 5000) {
|
||||||
@ -180,7 +181,7 @@ void tst_QTcpServer::ipv6LoopbackPerformanceTest()
|
|||||||
QVERIFY(clientB);
|
QVERIFY(clientB);
|
||||||
|
|
||||||
QByteArray buffer(16384, '@');
|
QByteArray buffer(16384, '@');
|
||||||
QTime stopWatch;
|
QElapsedTimer stopWatch;
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
qlonglong totalWritten = 0;
|
qlonglong totalWritten = 0;
|
||||||
while (stopWatch.elapsed() < 5000) {
|
while (stopWatch.elapsed() < 5000) {
|
||||||
@ -230,7 +231,7 @@ void tst_QTcpServer::ipv4PerformanceTest()
|
|||||||
QVERIFY(clientB);
|
QVERIFY(clientB);
|
||||||
|
|
||||||
QByteArray buffer(16384, '@');
|
QByteArray buffer(16384, '@');
|
||||||
QTime stopWatch;
|
QElapsedTimer stopWatch;
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
qlonglong totalWritten = 0;
|
qlonglong totalWritten = 0;
|
||||||
while (stopWatch.elapsed() < 5000) {
|
while (stopWatch.elapsed() < 5000) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -27,6 +27,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtOpenGL>
|
#include <QtOpenGL>
|
||||||
|
#include <QtCore/QElapsedTimer>
|
||||||
|
|
||||||
#include <qtest.h>
|
#include <qtest.h>
|
||||||
|
|
||||||
@ -400,7 +401,7 @@ void OpenGLBench::textureUpload()
|
|||||||
|
|
||||||
pb->makeCurrent();
|
pb->makeCurrent();
|
||||||
QGLContext *context = const_cast<QGLContext *>(QGLContext::currentContext());
|
QGLContext *context = const_cast<QGLContext *>(QGLContext::currentContext());
|
||||||
QTime time;
|
QElapsedTimer time;
|
||||||
|
|
||||||
time.start();
|
time.start();
|
||||||
context->bindTexture(pixmap, GL_TEXTURE_2D, format, (QGLContext::BindOptions) flags);
|
context->bindTexture(pixmap, GL_TEXTURE_2D, format, (QGLContext::BindOptions) flags);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the examples of the Qt Toolkit.
|
||||||
@ -27,7 +27,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTime>
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
#include "itemrecyclinglist.h"
|
#include "itemrecyclinglist.h"
|
||||||
#include "listitemcontainer.h"
|
#include "listitemcontainer.h"
|
||||||
@ -160,10 +160,10 @@ void ItemRecyclingList::themeChange()
|
|||||||
|
|
||||||
void ItemRecyclingList::keyPressEvent(QKeyEvent *event)
|
void ItemRecyclingList::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
static QTime keyPressInterval = QTime::currentTime();
|
static QElapsedTimer keyPressInterval;
|
||||||
static qreal step = 0.0;
|
static qreal step = 0.0;
|
||||||
static bool repeat = false;
|
static bool repeat = false;
|
||||||
int interval = keyPressInterval.elapsed();
|
int interval = keyPressInterval.isValid() ? keyPressInterval.elapsed() : 0;
|
||||||
|
|
||||||
ScrollBar* sb = verticalScrollBar();
|
ScrollBar* sb = verticalScrollBar();
|
||||||
qreal currentValue = sb->sliderPosition();
|
qreal currentValue = sb->sliderPosition();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the examples of the Qt Toolkit.
|
||||||
@ -132,7 +132,7 @@ qreal MainView::fps()
|
|||||||
void MainView::fpsReset()
|
void MainView::fpsReset()
|
||||||
{
|
{
|
||||||
m_frameCount = 0;
|
m_frameCount = 0;
|
||||||
m_fpsFirstTs.start();
|
m_fpsFirstTs = QTime::currentTime();
|
||||||
m_fpsLatestTs = m_fpsFirstTs;
|
m_fpsLatestTs = m_fpsFirstTs;
|
||||||
m_fpsUpdated.start();
|
m_fpsUpdated.start();
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ void MainView::paintEvent (QPaintEvent *event)
|
|||||||
emit repainted();
|
emit repainted();
|
||||||
|
|
||||||
m_frameCount++;
|
m_frameCount++;
|
||||||
m_fpsLatestTs.start();
|
m_fpsLatestTs = QTime::currentTime();
|
||||||
if(m_fpsUpdated.elapsed() > 2000) {
|
if(m_fpsUpdated.elapsed() > 2000) {
|
||||||
updateFps();
|
updateFps();
|
||||||
m_fpsUpdated.start();
|
m_fpsUpdated.start();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the examples of the Qt Toolkit.
|
||||||
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
#include <QElapsedTimer>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
@ -100,7 +101,7 @@ private:
|
|||||||
QTime m_fpsFirstTs;
|
QTime m_fpsFirstTs;
|
||||||
QTime m_fpsLatestTs;
|
QTime m_fpsLatestTs;
|
||||||
bool m_OutputFps;
|
bool m_OutputFps;
|
||||||
QTime m_fpsUpdated;
|
QElapsedTimer m_fpsUpdated;
|
||||||
QList<qreal> m_Fpss;
|
QList<qreal> m_Fpss;
|
||||||
|
|
||||||
int m_angle;
|
int m_angle;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the examples of the Qt Toolkit.
|
||||||
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTime>
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
#include "scroller.h"
|
#include "scroller.h"
|
||||||
|
|
||||||
@ -70,8 +70,8 @@ public:
|
|||||||
QPoint m_cursorPos;
|
QPoint m_cursorPos;
|
||||||
QPointF m_speed;
|
QPointF m_speed;
|
||||||
State m_state;
|
State m_state;
|
||||||
QTime m_lastCursorTime;
|
QElapsedTimer m_lastCursorTime;
|
||||||
QTime m_lastFrameTime;
|
QElapsedTimer m_lastFrameTime;
|
||||||
QTimer m_scrollTimer;
|
QTimer m_scrollTimer;
|
||||||
int m_scrollSlowAccum;
|
int m_scrollSlowAccum;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the examples of the Qt Toolkit.
|
||||||
@ -29,7 +29,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QGraphicsLinearLayout>
|
#include <QGraphicsLinearLayout>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QTime>
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
#include "simplelist.h"
|
#include "simplelist.h"
|
||||||
static const int MinItemWidth = 276;
|
static const int MinItemWidth = 276;
|
||||||
@ -99,10 +99,10 @@ void SimpleList::setListItemCaching(bool enable)
|
|||||||
|
|
||||||
void SimpleList::keyPressEvent(QKeyEvent *event)
|
void SimpleList::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
static QTime keyPressInterval = QTime::currentTime();
|
static QElapsedTimer keyPressInterval;
|
||||||
static qreal step = 0.0;
|
static qreal step = 0.0;
|
||||||
static bool repeat = false;
|
static bool repeat = false;
|
||||||
int interval = keyPressInterval.elapsed();
|
int interval = keyPressInterval.isValid() ? keyPressInterval.elapsed() : 0;
|
||||||
|
|
||||||
ScrollBar* sb = verticalScrollBar();
|
ScrollBar* sb = verticalScrollBar();
|
||||||
qreal currentValue = sb->sliderPosition();
|
qreal currentValue = sb->sliderPosition();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -72,7 +72,6 @@ void ChipTester::runBenchmark()
|
|||||||
{
|
{
|
||||||
npaints = 0;
|
npaints = 0;
|
||||||
timerId = startTimer(0);
|
timerId = startTimer(0);
|
||||||
stopWatch.start();
|
|
||||||
eventLoop.exec();
|
eventLoop.exec();
|
||||||
killTimer(timerId);
|
killTimer(timerId);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include <QtWidgets/QGraphicsView>
|
#include <QtWidgets/QGraphicsView>
|
||||||
#include <QtCore/QEventLoop>
|
#include <QtCore/QEventLoop>
|
||||||
#include <QtCore/QTime>
|
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QGraphicsScene)
|
QT_FORWARD_DECLARE_CLASS(QGraphicsScene)
|
||||||
QT_FORWARD_DECLARE_CLASS(QGraphicsView)
|
QT_FORWARD_DECLARE_CLASS(QGraphicsView)
|
||||||
@ -67,7 +66,6 @@ private:
|
|||||||
int npaints;
|
int npaints;
|
||||||
int timerId;
|
int timerId;
|
||||||
QEventLoop eventLoop;
|
QEventLoop eventLoop;
|
||||||
QTime stopWatch;
|
|
||||||
Operation operation;
|
Operation operation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user