genbindings/transform: fix missing enums/typedefs from inner classes

This commit is contained in:
mappu 2024-09-21 11:02:05 +12:00
parent b11e21092a
commit d8239b6a91
3 changed files with 15 additions and 4 deletions

View File

@ -21,9 +21,6 @@ func InsertTypedefs() {
// Not sure the reason for this one
KnownTypedefs["QSocketDescriptor::DescriptorType"] = CppTypedef{"QSocketDescriptor::DescriptorType", parseSingleTypeString("QSocketNotifier::Type")}
// QFlags<> typedef
KnownTypedefs["QTouchEvent::TouchPoint::InfoFlags"] = CppTypedef{"QTouchEvent::TouchPoint::InfoFlags", parseSingleTypeString("QFlags<QTouchEvent::TouchPoint::InfoFlag>")}
// QFile doesn't see QFileDevice parent class enum
KnownTypedefs["QFile::Permissions"] = CppTypedef{"QFile::Permissions", parseSingleTypeString("QFileDevice::Permissions")}
KnownTypedefs["QFileDevice::Permissions"] = CppTypedef{"QFile::Permissions", parseSingleTypeString("QFlags<QFileDevice::Permission>")}

View File

@ -24,11 +24,18 @@ func astTransformChildClasses(parsed *CppParsedHeader) {
var taken []CppClass
for i, c := range parsed.Classes {
taken = append(taken, takeChildren(&parsed.Classes[i])...)
nestedClasses := takeChildren(&parsed.Classes[i])
taken = append(taken, nestedClasses...)
// Also lift all child typedefs and enums
parsed.Typedefs = append(parsed.Typedefs, c.ChildTypedefs...)
parsed.Enums = append(parsed.Enums, c.ChildEnums...)
for _, nc := range nestedClasses {
parsed.Typedefs = append(parsed.Typedefs, nc.ChildTypedefs...)
parsed.Enums = append(parsed.Enums, nc.ChildEnums...)
}
}
parsed.Classes = append(parsed.Classes, taken...)

View File

@ -65,6 +65,13 @@ const (
QInputMethodEvent__AttributeType__Selection QInputMethodEvent__AttributeType = 4
)
type QTouchEvent__TouchPoint__InfoFlag int
const (
QTouchEvent__TouchPoint__InfoFlag__Pen QTouchEvent__TouchPoint__InfoFlag = 1
QTouchEvent__TouchPoint__InfoFlag__Token QTouchEvent__TouchPoint__InfoFlag = 2
)
type QScrollEvent__ScrollState int
const (