diff --git a/cmd/genbindings/emitcabi.go b/cmd/genbindings/emitcabi.go index 36fd366e..663d7886 100644 --- a/cmd/genbindings/emitcabi.go +++ b/cmd/genbindings/emitcabi.go @@ -1026,6 +1026,14 @@ func emitBindingCpp(src *CppParsedHeader, filename string) (string, error) { callTarget += m.CppCallTarget() + "(" + forwarding + ")" + // Qt 6.8 moved many operator== implementations from class methods + // into global operators. + // By using infix syntax, either can be called + if m.IsReadonlyOperator() && len(m.Parameters) == 1 { + operator := m.CppCallTarget()[8:] + callTarget = "(*self " + operator + " " + forwarding + ")" + } + if m.LinuxOnly { ret.WriteString(fmt.Sprintf( "%s %s_%s(%s) {\n"+ diff --git a/cmd/genbindings/intermediate.go b/cmd/genbindings/intermediate.go index 2ed07665..2de8067c 100644 --- a/cmd/genbindings/intermediate.go +++ b/cmd/genbindings/intermediate.go @@ -348,6 +348,16 @@ func (nm CppMethod) SafeMethodName() string { return tmp } +func (nm CppMethod) IsReadonlyOperator() bool { + targ := nm.CppCallTarget() + switch targ { + case "operator==", "operator!=", + "operator<", "operator<=", "operator>", "operator>=": + return true + } + return false +} + type CppEnumEntry struct { EntryName string EntryValue string