fix qtmoc

This commit is contained in:
therecipe 2016-11-19 20:08:37 +01:00
parent 4efdadb17c
commit 5218638454

View file

@ -137,6 +137,44 @@ func (c *Class) IsQObjectSubClass() bool {
}
func (c *Class) add() {
//TODO: needed until input + cgo support for generic Containers<T> to ignore virtuals with moc
if c.Module == MOC {
for _, sbc := range c.GetBases() {
for _, sbcf := range ClassMap[sbc].Functions {
if IsPackedList(sbcf.Output) {
sbcf.Virtual = "non"
sbcf.Meta = PLAIN
}
}
}
//add generic qRegisterMetaType functions
if !c.HasFunctionWithName("qRegisterMetaType") {
var tmpF = &Function{
Name: "qRegisterMetaType",
Fullname: fmt.Sprintf("%v::qRegisterMetaType", c.Name),
Access: "public",
Virtual: "non",
Meta: PLAIN,
NonMember: true,
NonMoc: true,
Output: fmt.Sprintf("int"),
Parameters: []*Parameter{},
Signature: "()",
TemplateModeGo: fmt.Sprintf("%v*", c.Name),
}
c.Functions = append(c.Functions, tmpF)
var f = *tmpF
f.Overload = true
f.OverloadNumber = "2"
f.Parameters = []*Parameter{{Name: "typeName", Value: "const char *"}}
f.Signature = "(const char *typeName)"
c.Functions = append(c.Functions, &f)
}
}
switch c.Name {
case "QColor", "QFont", "QImage":
{
@ -225,43 +263,6 @@ func (c *Class) add() {
}
}
//TODO: needed until input + cgo support for generic Containers<T> to ignore virtuals with moc
if c.Module == MOC {
for _, sbc := range c.GetBases() {
for _, sbcf := range ClassMap[sbc].Functions {
if IsPackedList(sbcf.Output) {
sbcf.Virtual = "non"
sbcf.Meta = PLAIN
}
}
}
//add generic qRegisterMetaType functions
if !c.HasFunctionWithName("qRegisterMetaType") {
var tmpF = &Function{
Name: "qRegisterMetaType",
Fullname: fmt.Sprintf("%v::qRegisterMetaType", c.Name),
Access: "public",
Virtual: "non",
Meta: PLAIN,
NonMember: true,
NonMoc: true,
Output: fmt.Sprintf("int"),
Parameters: []*Parameter{},
Signature: "()",
TemplateModeGo: fmt.Sprintf("%v*", c.Name),
}
c.Functions = append(c.Functions, tmpF)
var f = *tmpF
f.Overload = true
f.OverloadNumber = "2"
f.Parameters = []*Parameter{{Name: "typeName", Value: "const char *"}}
f.Signature = "(const char *typeName)"
c.Functions = append(c.Functions, &f)
}
}
if IsPackedList(f.Output) {
var b bool
for _, p := range f.Parameters {