From 8d07be763abebca6b8c70a0a96594a641b6d833a Mon Sep 17 00:00:00 2001 From: mappu Date: Thu, 3 Oct 2024 19:31:52 +1300 Subject: [PATCH] uic: emit warnings for unhandled item properties --- cmd/miqt-uic/ui2go.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/miqt-uic/ui2go.go b/cmd/miqt-uic/ui2go.go index 9dcc19a..536e7a0 100644 --- a/cmd/miqt-uic/ui2go.go +++ b/cmd/miqt-uic/ui2go.go @@ -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") + + } } }