【发布时间】:2019-03-24 12:20:16
【问题描述】:
QT QML 中是否有一个简单的函数可以将毫秒转换为格式为 hh:mm:ss:zzz 的用户可读时间?我找到了 tis 文档https://doc.qt.io/qt-5/qml-qtqml-date.html,但我真的不明白如何在我的情况下使用它。到目前为止,这是我的代码,但它只显示秒和毫秒。
import QtQuick 2.8
import QtQuick.Controls 2.1
Rectangle {
id: mapItem
anchors.fill: parent
property int count: 0
Timer {
id: timer
interval: 100
running: true
repeat: true
onTriggered: count += 1
}
Text {
text: (count / 10).toFixed(3)
font.pixelSize: 20
font.bold: true
font.family: "Eurostile"}
}
【问题讨论】: