FpsDisplay.qml 885 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
import QtQuick 2.11

Rectangle {
    id: fpsDisplayControl

    property real fps: 0.0
    property alias textcolor: fpsText.color
    property alias fpslabel: fpsLabelText.text
    color: "black"

    Text {
        id: fpsText
        text: fps.toFixed(1)
        font.family: "Helvetica"
        font.pixelSize: fpsDisplayControl.width / 2
        font.weight: Font.Light
        color: "white"
        width: parent.width
        verticalAlignment: Text.AlignVCenter
        horizontalAlignment: Text.AlignHCenter
    }

    Text {
        id: fpsLabelText
        text: "FPS"
        font.family: "Helvetica"
        font.pixelSize: fpsDisplayControl.width / 5
        font.weight: Font.Light
        color: "white"
        width: parent.width
        anchors.top: fpsText.bottom
        verticalAlignment: Text.AlignVCenter
        horizontalAlignment: Text.AlignHCenter
    }
}