FrameTimer QML Type

Provides frame-rate information about a given window. More...

Import Statement: import QtApplicationManager 2.0

Properties

Methods

Detailed Description

FrameTimer is used to get frame-rate information for a given window. The window can be either a toplevel Window (from the QtQuick.Window module) or a WindowObject (from the QtApplicationManager.SystemUI module).

The following snippet shows how to use FrameTimer to display the frame-rate of a Window:

import QtQuick
import QtApplicationManager

Window {
    id: toplevelWindow
    ...
    FrameTimer {
        id: frameTimer
        running: topLevelWindow.visible
        window: toplevelWindow
    }
    Text {
        text: "FPS: " + Number(frameTimer.averageFps).toLocaleString(Qt.locale("en_US"), 'f', 1)
    }
}

You can also use this component as a MonitorModel data source if you want to plot its previous values over time:

import QtQuick
import QtApplicationManager

Window {
    id: toplevelWindow
    ...
    MonitorModel {
        running: true
        FrameTimer {
            window: toplevelWindow
        }
    }
}

Please note that when using FrameTimer as a MonitorModel data source there's no need to set it to running as MonitorModel will already call update() as needed.

Property Documentation

averageFps : real [read-only]

The average frame rate of the given window, in frames per second, since update() was last called (either manually or automatically in case running is set to true).

See also window, running, and update().


interval : int

The interval, in milliseconds, between update() calls while running is true.

See also update() and running.


jitterFps : real [read-only]

The frame rate jitter of the given window, in frames per second, since update() was last called (either manually or automatically in case running is set to true).

See also window, running, and update().


maximumFps : real [read-only]

The maximum frame rate of the given window, in frames per second, since update() was last called (either manually or automatically in case running is set to true).

See also window, running, and update().


minimumFps : real [read-only]

The minimum frame rate of the given window, in frames per second, since update() was last called (either manually or automatically in case running is set to true).

See also window, running, and update().


roleNames : list<string> [read-only]

Names of the roles provided by FrameTimer when used as a MonitorModel data source.

See also MonitorModel.


running : bool

If true, update() will get called automatically every interval milliseconds.

When using FrameTimer as a MonitorModel data source, this property should be kept as false.

See also update() and interval.


window : Object

The window to be monitored, from which frame-rate information will be gathered. It can be either a toplevel Window (from the QtQuick.Window module) or a WindowObject (from the QtApplicationManager.SystemUI module).

See also WindowObject.


Method Documentation

update()

Updates the properties averageFps, minimumFps, maximumFps and jitterFps. Then resets internal counters so that new numbers can be taken for the new time period starting from the moment this method is called.

Note that you normally don't have to call this method directly, as FrameTimer does it automatically every interval milliseconds while running is set to true.

See also running.


© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.