uic: move all setCurrentIndex() calls to end, to match qt uic output

This commit is contained in:
mappu 2024-10-03 19:32:17 +13:00
parent 6ed51553ac
commit 773cbec6b0
1 changed files with 9 additions and 2 deletions

View File

@ -479,17 +479,24 @@ func New` + u.Class + `Ui() *` + u.Class + `Ui {
// Don't emit any of the lines that included .Tr(), move them into the
// retranslateUi() function
var translateFunc []string
var setCurrentIndex []string
for _, line := range strings.Split(nest, "\n") {
if strings.Contains(line, `_Tr(`) {
translateFunc = append(translateFunc, line)
} else if strings.Contains(line, `.SetCurrentIndex(`) {
setCurrentIndex = append(setCurrentIndex, line)
} else {
ret.WriteString(line + "\n")
}
}
ret.WriteString(`
ui.Retranslate()
ret.WriteString("\nui.Retranslate()\n\n")
for _, sci := range setCurrentIndex {
ret.WriteString(sci + "\n")
}
ret.WriteString(`
return ui
}