Project: Qt 5 only support simple qsTr or qsTranslate(in the same file).
This commit is contained in:
parent
1354767d6a
commit
461dbdbf47
|
@ -9,10 +9,12 @@ RibbonSplashScreen {
|
|||
contentArgs: {
|
||||
"implicitHeight": 250,
|
||||
"implicitWidth": 450,
|
||||
"titleText": QT_TRANSLATE_NOOP("RibbonSplashScreen", "Example App"),
|
||||
"subTitleText": QT_TRANSLATE_NOOP("RibbonSplashScreen", "A example for users to use RibbonUI.")
|
||||
"titleText": qsTr("Example App"),
|
||||
"subTitleText": qsTr("A example for users to use RibbonUI.")
|
||||
}
|
||||
|
||||
onContentArgsChanged: loadItemArgs()
|
||||
|
||||
Timer{
|
||||
interval: 1000
|
||||
triggeredOnStart: true
|
||||
|
|
|
@ -68,8 +68,8 @@ RibbonWindow {
|
|||
RibbonTour{
|
||||
id: tour
|
||||
RibbonTourItem{
|
||||
title: QT_TRANSLATE_NOOP("RibbonTour", "Tab Bar")
|
||||
text: QT_TRANSLATE_NOOP("RibbonTour", "A tab bar for window, let user choose the controllers.")
|
||||
title: qsTr("Tab Bar")
|
||||
text: qsTr("A tab bar for window, let user choose the controllers.")
|
||||
target: tab_bar
|
||||
enterFunc: ()=>{
|
||||
tab_bar.folded = false
|
||||
|
@ -77,13 +77,13 @@ RibbonWindow {
|
|||
}
|
||||
}
|
||||
RibbonTourItem{
|
||||
title: QT_TRANSLATE_NOOP("RibbonTour", "Tab Bar Buttons")
|
||||
text: QT_TRANSLATE_NOOP("RibbonTour", "Tool buttons at the top of tab bar.")
|
||||
title: qsTr("Tab Bar Buttons")
|
||||
text: qsTr("Tool buttons at the top of tab bar.")
|
||||
target: tab_bar.tab_bar_tool
|
||||
}
|
||||
RibbonTourItem{
|
||||
title: QT_TRANSLATE_NOOP("RibbonTour", "Sliders")
|
||||
text: QT_TRANSLATE_NOOP("RibbonTour", "Vertical/Horizental sliders with/without buttons.")
|
||||
title: qsTr("Sliders")
|
||||
text: qsTr("Vertical/Horizental sliders with/without buttons.")
|
||||
target: tab_bar.slider_layout
|
||||
enterFunc: ()=>{
|
||||
tab_bar.setPage(0)
|
||||
|
@ -97,32 +97,32 @@ RibbonWindow {
|
|||
}
|
||||
}
|
||||
RibbonTourItem{
|
||||
title: QT_TRANSLATE_NOOP("RibbonTour", "Switch Buttons")
|
||||
text: QT_TRANSLATE_NOOP("RibbonTour", "Switch buttons with/without background color or grabber text.")
|
||||
title: qsTr("Switch Buttons")
|
||||
text: qsTr("Switch buttons with/without background color or grabber text.")
|
||||
target: tab_bar.switch_layout
|
||||
enterFunc: ()=>tab_bar.btn_with_color_and_grabberText.checked = true
|
||||
exitFunc: ()=>tab_bar.btn_with_color_and_grabberText.checked = false
|
||||
}
|
||||
RibbonTourItem{
|
||||
title: QT_TRANSLATE_NOOP("RibbonTour", "CheckBoxs")
|
||||
text: QT_TRANSLATE_NOOP("RibbonTour", "CheckBoxs with colorful background or with/without label text.")
|
||||
title: qsTr("CheckBoxs")
|
||||
text: qsTr("CheckBoxs with colorful background or with/without label text.")
|
||||
target: tab_bar.checkbox_layout
|
||||
}
|
||||
RibbonTourItem{
|
||||
title: QT_TRANSLATE_NOOP("RibbonTour", "Buttons")
|
||||
text: QT_TRANSLATE_NOOP("RibbonTour", "Buttons with/without background or label text.")
|
||||
title: qsTr("Buttons")
|
||||
text: qsTr("Buttons with/without background or label text.")
|
||||
target: tab_bar.button_layout
|
||||
enterFunc: ()=>tab_bar.btn_without_bg_and_label.checked = true
|
||||
exitFunc: ()=>tab_bar.btn_without_bg_and_label.checked = false
|
||||
}
|
||||
RibbonTourItem{
|
||||
title: QT_TRANSLATE_NOOP("RibbonTour", "Push Buttons")
|
||||
text: QT_TRANSLATE_NOOP("RibbonTour", "Push buttons with/without sub menu.")
|
||||
title: qsTr("Push Buttons")
|
||||
text: qsTr("Push buttons with/without sub menu.")
|
||||
target: tab_bar.pushbutton_layout
|
||||
}
|
||||
RibbonTourItem{
|
||||
title: QT_TRANSLATE_NOOP("RibbonTour", "Line Edits")
|
||||
text: QT_TRANSLATE_NOOP("RibbonTour", "Line edits with/without icon.")
|
||||
title: qsTr("Line Edits")
|
||||
text: qsTr("Line edits with/without icon.")
|
||||
target: tab_bar.lineedit_layout
|
||||
enterFunc: ()=>{
|
||||
tab_bar.setPage(1)
|
||||
|
@ -136,8 +136,8 @@ RibbonWindow {
|
|||
}
|
||||
}
|
||||
RibbonTourItem{
|
||||
title: QT_TRANSLATE_NOOP("RibbonTour", "Bottom Bar")
|
||||
text: QT_TRANSLATE_NOOP("RibbonTour", "A bottom bar for window.")
|
||||
title: qsTr("Bottom Bar")
|
||||
text: qsTr("A bottom bar for window.")
|
||||
target: bottom_bar
|
||||
}
|
||||
target: windowItems
|
||||
|
@ -375,42 +375,42 @@ RibbonWindow {
|
|||
blurTarget: root.windowItems
|
||||
radius: borderRadius
|
||||
RibbonBackStageMenuItem{
|
||||
menuText: QT_TRANSLATE_NOOP("RibbonBackStageView","Home")
|
||||
menuText: qsTr("Home")
|
||||
menuIcon: RibbonIcons.Home
|
||||
type: RibbonBackStageView.MenuItemLocation.Head
|
||||
sourceComponent: t_content
|
||||
sourceArgs:{'pageName':QT_TR_NOOP("Home")}
|
||||
}
|
||||
RibbonBackStageMenuItem{
|
||||
menuText: QT_TRANSLATE_NOOP("RibbonBackStageView","File")
|
||||
menuText: qsTr("File")
|
||||
menuIcon: RibbonIcons.Document
|
||||
type: RibbonBackStageView.MenuItemLocation.Head
|
||||
sourceComponent: t_content
|
||||
sourceArgs:{'pageName':QT_TR_NOOP("File")}
|
||||
}
|
||||
RibbonBackStageMenuItem{
|
||||
menuText: QT_TRANSLATE_NOOP("RibbonBackStageView","Search")
|
||||
menuText: qsTr("Search")
|
||||
menuIcon: RibbonIcons.Search
|
||||
type: RibbonBackStageView.MenuItemLocation.Body
|
||||
sourceComponent: t_content
|
||||
sourceArgs:{'pageName':QT_TR_NOOP("Search")}
|
||||
}
|
||||
RibbonBackStageMenuItem{
|
||||
menuText: QT_TRANSLATE_NOOP("RibbonBackStageView","Account")
|
||||
menuText: qsTr("Account")
|
||||
menuIcon: RibbonIcons.PersonAccounts
|
||||
type: RibbonBackStageView.MenuItemLocation.Tail
|
||||
clickOnly: true
|
||||
clickFunc: ()=>console.log("Menu Account clicked")
|
||||
}
|
||||
RibbonBackStageMenuItem{
|
||||
menuText: QT_TRANSLATE_NOOP("RibbonBackStageView","About")
|
||||
menuText: qsTr("About")
|
||||
menuIcon: RibbonIcons.Info
|
||||
type: RibbonBackStageView.MenuItemLocation.Tail
|
||||
clickOnly: true
|
||||
clickFunc: ()=>root.showWindow(Qt.resolvedUrl("about.qml"))
|
||||
}
|
||||
RibbonBackStageMenuItem{
|
||||
menuText: QT_TRANSLATE_NOOP("RibbonBackStageView","Settings")
|
||||
menuText: qsTr("Settings")
|
||||
menuIcon: RibbonIcons.Settings
|
||||
type: RibbonBackStageView.MenuItemLocation.Tail
|
||||
sourceUrl: Qt.resolvedUrl("pages/SettingsMenuPage.qml")
|
||||
|
|
|
@ -34,16 +34,7 @@ Window {
|
|||
item.onDestroyed.connect(function(){
|
||||
root.showLoadingLog.disconnect(item.dealWithLog)
|
||||
})
|
||||
if (!Object.keys(container.args).length)
|
||||
return
|
||||
else if(Object.keys(container.args).length){
|
||||
for (let arg in container.args){
|
||||
item[arg] = container.args[arg]
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.error("RibbonSplashScreen: Arguments error, please check.")
|
||||
}
|
||||
loadItemArgs()
|
||||
}
|
||||
onStatusChanged: {
|
||||
if(status === Loader.Null &&
|
||||
|
@ -153,4 +144,19 @@ Window {
|
|||
internal.isComponentReady = true
|
||||
}
|
||||
}
|
||||
|
||||
function loadItemArgs(){
|
||||
if(loader.item){
|
||||
if (!Object.keys(container.args).length)
|
||||
return
|
||||
else if(Object.keys(container.args).length){
|
||||
for (let arg in container.args){
|
||||
loader.item[arg] = container.args[arg]
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.error("RibbonSplashScreen: Arguments error, please check.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,16 +34,7 @@ Window {
|
|||
item.onDestroyed.connect(function(){
|
||||
root.showLoadingLog.disconnect(item.dealWithLog)
|
||||
})
|
||||
if (!Object.keys(container.args).length)
|
||||
return
|
||||
else if(Object.keys(container.args).length){
|
||||
for (let arg in container.args){
|
||||
item[arg] = container.args[arg]
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.error("RibbonSplashScreen: Arguments error, please check.")
|
||||
}
|
||||
loadItemArgs()
|
||||
}
|
||||
onStatusChanged: {
|
||||
if(status === Loader.Null &&
|
||||
|
@ -153,4 +144,19 @@ Window {
|
|||
internal.isComponentReady = true
|
||||
}
|
||||
}
|
||||
|
||||
function loadItemArgs(){
|
||||
if(loader.item){
|
||||
if (!Object.keys(container.args).length)
|
||||
return
|
||||
else if(Object.keys(container.args).length){
|
||||
for (let arg in container.args){
|
||||
loader.item[arg] = container.args[arg]
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.error("RibbonSplashScreen: Arguments error, please check.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue