1
我想在我的工具欄上進行翻譯。工具欄是一個listmodel:如何製作翻譯qml
import QtQuick 1.1
ListModel {
id:tBar
ListElement {
buttonText: QT_TR_NOOP("Cars In Speed Function")
bottomText: ""
event: "carsInSpdFn"
buttonLevel: "0"
buttonBurst: false
icon: "qrc:/icons/histogram_128x128_w.png"
color: "#369c3b"
active: true
permissionLevel: 0
}
ListElement {
buttonText: QT_TR_NOOP("Clear all logs")
bottomText: ""
event: "cleraAllLogs"
buttonLevel: "0"
buttonBurst: false
icon: "qrc:/icons/trash_128x128_w.png"
color: "steelblue"
active: true
permissionLevel: 3
}
該列表在文件中調用屬性變量值。 主文件:
/..
DynamicApp{
id: statistics
objectName: "Statistics"
toolbarModel: ToolbarModel{}
title: qsTr("Statistics management")
icon: "qrc:/icons/statistics_128x128_w.png"
../
的DynamicApp是其中所定義的應用程序的窗口的QML文件。定義的toolbarModel是「屬性變體」。 DynamicApp:
/..
Rectangle {
id: app
width: main.width
height: main.height
color: layout_id.bgColor
opacity: 0
property variant parameter;
property bool useToolbar: true
property bool useTopbar: true
property bool activeApp: false
property variant toolbarModel
property string title: ""
property string icon: ""
../
我知道如何通過QSTR或qsTranslate型號列表翻譯,但我不知道如何把它變成CAL財產變種becouse有調用到所有的文件toolbarModel。 你能解釋我如何在我的應用程序中翻譯這個列表嗎?