diff --git a/cmd/genbindings/config-allowlist.go b/cmd/genbindings/config-allowlist.go index c11069f4..53d48d35 100644 --- a/cmd/genbindings/config-allowlist.go +++ b/cmd/genbindings/config-allowlist.go @@ -385,6 +385,12 @@ func AllowType(p CppParameter, isReturnType bool) error { if strings.HasPrefix(p.ParameterType, "EncodedData<") { return ErrTooComplex // e.g. Qt 6 qstringconverter.h } + if strings.HasPrefix(p.ParameterType, "QQmlListProperty<") { + return ErrTooComplex // e.g. Qt 5 QWebChannel qmlwebchannel.h . Supporting this will be required for QML in future + } + if strings.HasPrefix(p.ParameterType, "QWebEngineCallback<") { + return ErrTooComplex // Function pointer types in QtWebEngine + } if strings.HasPrefix(p.ParameterType, "std::") { // std::initializer e.g. qcborarray.h @@ -510,6 +516,7 @@ func AllowType(p CppParameter, isReturnType bool) error { "QPostEvent", // .. "QWebFrameAdapter", // Qt 5 Webkit: Used by e.g. qwebframe.h but never defined anywhere "QWebPageAdapter", // ... + "QQmlWebChannelAttached", // Qt 5 qqmlwebchannel.h. Need to add QML support for this to work "____last____": return ErrTooComplex } diff --git a/cmd/genbindings/config-libraries.go b/cmd/genbindings/config-libraries.go index 4ea894b5..944c98c7 100644 --- a/cmd/genbindings/config-libraries.go +++ b/cmd/genbindings/config-libraries.go @@ -129,6 +129,41 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) { ClangMatchSameHeaderDefinitionOnly, ) + // Qt 5 QWebChannel + generate( + "qt/webchannel", + []string{ + "/usr/include/x86_64-linux-gnu/qt5/QtWebChannel", + }, + AllowAllHeaders, + clangBin, + pkgConfigCflags("Qt5WebChannel"), + outDir, + ClangMatchSameHeaderDefinitionOnly, + ) + + // Qt 5 QWebEngine + generate( + "qt/webengine", + []string{ + "/usr/include/x86_64-linux-gnu/qt5/QtWebEngine", + "/usr/include/x86_64-linux-gnu/qt5/QtWebEngineCore", + "/usr/include/x86_64-linux-gnu/qt5/QtWebEngineWidgets", + }, + + func(fullpath string) bool { + baseName := filepath.Base(fullpath) + if baseName == "qquickwebengineprofile.h" || baseName == "qquickwebenginescript.h" { + return false + } + return true + }, + clangBin, + pkgConfigCflags("Qt5WebEngineWidgets"), + outDir, + ClangMatchSameHeaderDefinitionOnly, + ) + // Depends on QtCore/Gui/Widgets, QPrintSupport generate( "qt-restricted-extras/qscintilla", @@ -269,6 +304,40 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) { ClangMatchSameHeaderDefinitionOnly, ) + // Qt 6 QWebChannel + generate( + "qt6/webchannel", + []string{ + "/usr/include/x86_64-linux-gnu/qt6/QtWebChannel", + }, + AllowAllHeaders, + clangBin, + "--std=c++17 "+pkgConfigCflags("Qt6WebChannel"), + outDir, + ClangMatchSameHeaderDefinitionOnly, + ) + + // Qt 6 QWebEngine + generate( + "qt6/webengine", + []string{ + "/usr/include/x86_64-linux-gnu/qt6/QtWebEngineCore", + "/usr/include/x86_64-linux-gnu/qt6/QtWebEngineWidgets", + }, + func(fullpath string) bool { + baseName := filepath.Base(fullpath) + if baseName == "qtwebenginewidgets-config.h" { + return false + } + return true + }, + clangBin, + "--std=c++17 "+pkgConfigCflags("Qt6WebEngineWidgets"), + outDir, + ClangMatchSameHeaderDefinitionOnly, + ) + + // Qt 6 QScintilla // Depends on QtCore/Gui/Widgets, QPrintSupport generate( "qt-restricted-extras/qscintilla6", diff --git a/docker/genbindings.Dockerfile b/docker/genbindings.Dockerfile index 116caa4f..36ea65d9 100644 --- a/docker/genbindings.Dockerfile +++ b/docker/genbindings.Dockerfile @@ -8,9 +8,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ qtscript5-dev \ libqt5svg5-dev \ libqt5webkit5-dev \ + qtwebengine5-dev \ qt6-base-dev \ qt6-multimedia-dev \ qt6-svg-dev \ + qt6-webengine-dev \ libqscintilla2-qt5-dev \ libqscintilla2-qt6-dev \ clang \