uic: emit warnings for unhandled item properties

This commit is contained in:
mappu 2024-10-03 19:31:52 +13:00
parent 4c6062de1f
commit 8d07be763a

View File

@ -330,8 +330,13 @@ func generateWidget(w UiWidget, parentName string, parentClass string) (string,
// Check for a "text" property and update the item's text
// Do this as a 2nd step so that the SetItemText can be trapped for retranslateUi()
// TODO Abstract for all SetItem{Foo} properties
if prop, ok := propertyByName(itm.Properties, "text"); ok {
ret.WriteString("ui." + w.Name + `.SetItemText(` + fmt.Sprintf("%d", itemNo) + `, ` + generateString(prop.StringVal, w.Class) + `)` + "\n")
for _, prop := range itm.Properties {
if prop.Name == "text" {
ret.WriteString("ui." + w.Name + `.SetItemText(` + fmt.Sprintf("%d", itemNo) + `, ` + generateString(prop.StringVal, w.Class) + `)` + "\n")
} else {
ret.WriteString("/* miqt-uic: no handler for item property '" + prop.Name + "' */\n")
}
}
}