diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-07-11 09:12:00 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-07-18 07:45:24 +0000 |
commit | dde49f989e6f77a8db87d7fafc2d4ced34113135 (patch) | |
tree | 5684c1e0e166e5dd5d575697fde728f81f00c289 /src/qmldebug | |
parent | 7bf74dbddb25d48e267788c02ee7d06288bfada9 (diff) |
QML Preview: Add a frames per second counter
It is instructive to the client to know how many frames per second the
current QML can achieve in the preview.
Change-Id: I8b73e2b5218410d903a07dfe27c038663c84fdee
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qmldebug')
-rw-r--r-- | src/qmldebug/qqmlpreviewclient.cpp | 27 | ||||
-rw-r--r-- | src/qmldebug/qqmlpreviewclient_p.h | 4 |
2 files changed, 22 insertions, 9 deletions
diff --git a/src/qmldebug/qqmlpreviewclient.cpp b/src/qmldebug/qqmlpreviewclient.cpp index fa040e226b..33a2f53ca4 100644 --- a/src/qmldebug/qqmlpreviewclient.cpp +++ b/src/qmldebug/qqmlpreviewclient.cpp @@ -61,18 +61,29 @@ void QQmlPreviewClient::messageReceived(const QByteArray &message) qint8 command; packet >> command; - if (command == Error) { + switch (command) { + case Error: { QString seviceError; packet >> seviceError; emit error(seviceError); - return; + break; + } + case Request: { + QString fileName; + packet >> fileName; + emit request(fileName); + break; + } + case Fps: { + quint16 frames; + packet >> frames; + emit fps(frames); + break; + } + default: + emit error(QString::fromLatin1("Unknown command received: %1").arg(command)); + break; } - - Q_ASSERT(command == Request); - - QString fileName; - packet >> fileName; - emit request(fileName); } void QQmlPreviewClient::sendDirectory(const QString &path, const QStringList &entries) diff --git a/src/qmldebug/qqmlpreviewclient_p.h b/src/qmldebug/qqmlpreviewclient_p.h index 49d147c866..d79ecefe32 100644 --- a/src/qmldebug/qqmlpreviewclient_p.h +++ b/src/qmldebug/qqmlpreviewclient_p.h @@ -71,7 +71,8 @@ public: Rerun, Directory, ClearCache, - Zoom + Zoom, + Fps }; QQmlPreviewClient(QQmlDebugConnection *parent); @@ -88,6 +89,7 @@ public: signals: void request(const QString &path); void error(const QString &message); + void fps(quint16 frames); }; QT_END_NAMESPACE |