miqt-uic: support Tr() for top-level SetWindowText

This commit is contained in:
mappu 2025-05-28 17:54:26 +12:00
parent 7d9cb9ccd2
commit 86d963abba

View File

@ -72,10 +72,13 @@ func (gs *generateState) collectClassNames_Widget(u *UiWidget) []string {
}
func (gs *generateState) generateString(s *UiString, parentClass string) string {
if s.Notr || parentClass == "" {
if s.Notr {
return strconv.Quote(s.Value)
} else if parentClass == "" {
return `qt.QCoreApplication_Tr(` + strconv.Quote(s.Value) + `)`
} else {
return `qt.` + parentClass + `_Tr(` + strconv.Quote(s.Value) + `)`
}
return `qt.` + parentClass + `_Tr(` + strconv.Quote(s.Value) + `)`
}
// qwidgetName creates the T.QWidget name that MIQT needs to access the base class.