mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
uic: support enum-set properties
This commit is contained in:
parent
7e320004f5
commit
1a4d34185f
@ -80,6 +80,7 @@ type UiProperty struct {
|
||||
EnumVal *string `xml:"enum,omitempty"`
|
||||
RectVal *UiRect `xml:"rect,omitempty"`
|
||||
IconVal *UiIcon `xml:"iconset,omitempty"`
|
||||
SetVal *string `xml:"set,omitempty"`
|
||||
}
|
||||
|
||||
type UiActionReference struct {
|
||||
|
@ -162,6 +162,21 @@ func renderProperties(properties []UiProperty, ret *strings.Builder, targetName,
|
||||
// detect the case and convert it to match
|
||||
ret.WriteString(`ui.` + targetName + setterFunc + `(` + normalizeEnumName(*prop.EnumVal) + ")\n")
|
||||
|
||||
} else if prop.SetVal != nil {
|
||||
// QDialogButtonBox::"standardButtons"
|
||||
// <set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
|
||||
parts := strings.Split(*prop.SetVal, `|`)
|
||||
for i, p := range parts {
|
||||
parts[i] = normalizeEnumName(p)
|
||||
}
|
||||
|
||||
emit := "0"
|
||||
if len(parts) > 0 {
|
||||
emit = strings.Join(parts, `|`)
|
||||
}
|
||||
ret.WriteString(`ui.` + targetName + setterFunc + `(` + emit + ")\n")
|
||||
|
||||
} else if prop.IconVal != nil {
|
||||
iconName := renderIcon(prop.IconVal, ret)
|
||||
ret.WriteString(`ui.` + targetName + setterFunc + `(` + iconName + ")\n")
|
||||
|
Loading…
Reference in New Issue
Block a user