Skip to content

Commit

Permalink
genbindings/transform: fix missing enums/typedefs from inner classes
Browse files Browse the repository at this point in the history
  • Loading branch information
mappu committed Sep 20, 2024
1 parent b11e210 commit d8239b6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 0 additions & 3 deletions cmd/genbindings/exceptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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>")}
Expand Down
9 changes: 8 additions & 1 deletion cmd/genbindings/transformchildclasses.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down
7 changes: 7 additions & 0 deletions qt/gen_qevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit d8239b6

Please sign in to comment.