From b74698da7038cf6390e011337480605776462eb6 Mon Sep 17 00:00:00 2001 From: Wescoeur Date: Mon, 19 Jun 2017 23:30:11 +0200 Subject: [PATCH] feat(ImageProvider): add a timer to calculate image loading --- src/app/providers/ImageProvider.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/providers/ImageProvider.cpp b/src/app/providers/ImageProvider.cpp index d7fdd687b..d077ec977 100644 --- a/src/app/providers/ImageProvider.cpp +++ b/src/app/providers/ImageProvider.cpp @@ -20,13 +20,14 @@ * Author: Ronan Abhamon */ +#include #include #include #include #include #include -#include #include +#include #include "../App.hpp" @@ -207,6 +208,9 @@ ImageProvider::ImageProvider () : QQuickImageProvider( // ----------------------------------------------------------------------------- QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) { + QElapsedTimer timer; + timer.start(); + const QString path = QStringLiteral(":/assets/images/%1").arg(id); // 1. Read and update XML content. @@ -245,5 +249,7 @@ QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) { QPainter painter(&image); renderer.render(&painter); + qInfo() << QStringLiteral("Image `%1` loaded in %2 milliseconds.").arg(path).arg(timer.elapsed()); + return image; }