mirror of
https://github.com/mappu/miqt.git
synced 2025-05-12 06:30:22 +00:00
miqt-uic: support icon themes
This commit is contained in:
parent
2fc549206b
commit
b3b914ede8
@ -61,6 +61,7 @@ type UiString struct {
|
||||
|
||||
type UiIcon struct {
|
||||
ResourceFile string `xml:"resource,attr"`
|
||||
Theme string `xml:"theme,attr"`
|
||||
|
||||
NormalOff *string `xml:"normaloff,omitempty"`
|
||||
NormalOn *string `xml:"normalon,omitempty"`
|
||||
|
@ -75,14 +75,23 @@ func renderIcon(iconVal *UiIcon, ret *strings.Builder) string {
|
||||
iconName := fmt.Sprintf("icon%d", IconCounter)
|
||||
IconCounter++
|
||||
|
||||
if iconVal.Theme != "" {
|
||||
ret.WriteString(iconName + ` := qt.QIcon_FromTheme(` + strconv.Quote(iconVal.Theme) + ")\n")
|
||||
} else {
|
||||
ret.WriteString(iconName + " := qt.NewQIcon()\n")
|
||||
}
|
||||
|
||||
// A base entry is a synonym for NormalOff. Don't need them both
|
||||
if iconVal.NormalOff != nil {
|
||||
if iconVal.NormalOff != nil && *iconVal.NormalOff != "." {
|
||||
ret.WriteString(iconName + ".AddFile4(" + strconv.Quote(*iconVal.NormalOff) + ", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__Off)\n")
|
||||
} else {
|
||||
base := strings.TrimSpace(iconVal.Base)
|
||||
if base == "" || base == "." {
|
||||
// skip
|
||||
} else {
|
||||
ret.WriteString(iconName + ".AddFile(" + strconv.Quote(strings.TrimSpace(iconVal.Base)) + ")\n")
|
||||
}
|
||||
}
|
||||
|
||||
if iconVal.NormalOn != nil {
|
||||
ret.WriteString(iconName + ".AddFile4(" + strconv.Quote(*iconVal.NormalOn) + ", qt.NewQSize(), qt.QIcon__Normal, qt.QIcon__On)\n")
|
||||
|
Loading…
x
Reference in New Issue
Block a user