From ba9f51876706927666c01e8e10972d068f341c46 Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 26 Oct 2024 12:33:49 +1300 Subject: [PATCH] genbindings/config: adjustments for Qt 6.7 support --- cmd/genbindings/config-allowlist.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/cmd/genbindings/config-allowlist.go b/cmd/genbindings/config-allowlist.go index 63ca529a..c572cd10 100644 --- a/cmd/genbindings/config-allowlist.go +++ b/cmd/genbindings/config-allowlist.go @@ -118,6 +118,7 @@ func ImportHeaderForClass(className string) bool { "QTextEngine", // qtextlayout.h "QText", // e.g. qtextcursor.h "QVLABaseBase", // e.g. Qt 6 qvarlengtharray.h + "QAdoptSharedDataTag", // Qt 6 qshareddata.h "____last____": return false } @@ -127,7 +128,7 @@ func ImportHeaderForClass(className string) bool { func AllowClass(className string) bool { - if strings.HasSuffix(className, "Private") { + if strings.HasSuffix(className, "Private") || strings.HasSuffix(className, "PrivateShared") { return false } @@ -156,6 +157,9 @@ func AllowClass(className string) bool { "QSequentialIterable", // Qt 6. Extends a QIterator<>, too hard "QBrushDataPointerDeleter", // Qt 6 qbrush.h. Appears in header but cannot be linked "QPropertyBindingPrivatePtr", // Qt 6 qpropertyprivate.h. Appears in header but cannot be linked + "QDeferredDeleteEvent", // Qt 6. Hidden/undocumented class in Qt 6.4, moved to private header in Qt 6.7. Intended for test use only + + "QUntypedPropertyData::InheritsQUntypedPropertyData", // qpropertyprivate.h . Hidden/undocumented class in Qt 6.4, removed in 6.7 "____last____": return false } @@ -195,6 +199,14 @@ func AllowMethod(className string, mm CppMethod) error { return ErrTooComplex } + if className == "QBitArray" && mm.MethodName == "operator~" { + return ErrTooComplex // Present in Qt 5.15 and 6.4, missing in Qt 6.7 + } + + if className == "QTimeZone" && (mm.MethodName == "operator==" || mm.MethodName == "operator!=") { + return ErrTooComplex // Present in Qt 5.15 and 6.4, missing in Qt 6.7 + } + return nil // OK, allow } @@ -403,4 +415,13 @@ func ApplyQuirks(className string, mm *CppMethod) { if className == "QArrayData" && mm.MethodName == "needsDetach" && mm.IsConst { mm.BecomesNonConstInVersion = addr("6.7") } + + if className == "QFileDialog" && mm.MethodName == "saveFileContent" && mm.IsStatic { + // The prototype was changed from + // [Qt 5 - 6.6] void QFileDialog::saveFileContent(const QByteArray &fileContent, const QString &fileNameHint = QString()) + // [Qt 6.7] void QFileDialog::saveFileContent(const QByteArray &fileContent, const QString &fileNameHint, QWidget *parent = nullptr) + // The 2nd parameter is no longer optional + // As a compromise, make it non-optional everywhere + mm.Parameters[1].Optional = false + } }