mirror of
https://github.com/mappu/miqt.git
synced 2025-05-30 23:00:26 +00:00
qtermwidget5: add binding definitions
This commit is contained in:
parent
0d181122a3
commit
b973c5edc6
@ -42,6 +42,15 @@ func InsertTypedefs(qt6 bool) {
|
||||
},
|
||||
}}
|
||||
|
||||
// Qt 5 qtermwidget
|
||||
// The nested namespaces need better name resolution handling
|
||||
/*
|
||||
KnownTypedefs["KeyboardTranslator::Command"] = lookupResultTypedef{"qt/qtermwidget", CppTypedef{"KeyboardTranslator::Command", parseSingleTypeString("Konsole::KeyboardTranslator::Command")}}
|
||||
KnownTypedefs["KeyboardTranslator::Entry"] = lookupResultTypedef{"qt/qtermwidget", CppTypedef{"KeyboardTranslator::Entry", parseSingleTypeString("Konsole::KeyboardTranslator::Entry")}}
|
||||
KnownTypedefs["RegExpFilter::HotSpot"] = lookupResultTypedef{"qt/qtermwidget", CppTypedef{"RegExpFilter::HotSpot", parseSingleTypeString("Konsole::RegExpFilter::HotSpot")}}
|
||||
KnownTypedefs["Filter::HotSpot"] = lookupResultTypedef{"qt/qtermwidget", CppTypedef{"Filter::HotSpot", parseSingleTypeString("Konsole::Filter::HotSpot")}}
|
||||
*/
|
||||
|
||||
if qt6 {
|
||||
// Qt 6 QVariant helper types - needs investigation
|
||||
KnownTypedefs["QVariantHash"] = lookupResultTypedef{"qt6", "", CppTypedef{"QVariantHash", parseSingleTypeString("QHash<QString,QVariant>")}}
|
||||
@ -159,6 +168,8 @@ func ImportHeaderForClass(className string) bool {
|
||||
"QText", // e.g. qtextcursor.h
|
||||
"QVLABaseBase", // e.g. Qt 6 qvarlengtharray.h
|
||||
"QAdoptSharedDataTag", // Qt 6 qshareddata.h
|
||||
// "QTermWidget", // Qt 5 qtermwidget. Does not make nice <className> file helpers
|
||||
// "QTermWidgetInterface", // Qt 5 qtermwidget. Does not make nice <className> file helpers
|
||||
"____last____":
|
||||
return false
|
||||
}
|
||||
@ -386,6 +397,14 @@ func AllowMethod(className string, mm CppMethod) error {
|
||||
return ErrTooComplex // e.g. QSize::rheight()
|
||||
}
|
||||
|
||||
// Qt 5 libqtermwidget. This works and is present but the namespace lookups are messed up
|
||||
if className == "KeyboardTranslator::Command" ||
|
||||
className == "KeyboardTranslator::Entry" ||
|
||||
className == "RegExpFilter::HotSpot" ||
|
||||
className == "Filter::HotSpot" {
|
||||
return ErrTooComplex
|
||||
}
|
||||
|
||||
return nil // OK, allow
|
||||
}
|
||||
|
||||
@ -579,50 +598,59 @@ func AllowType(p CppParameter, isReturnType bool) error {
|
||||
"QPolygon", "QPolygonF", // QPolygon extends a template type
|
||||
"QGenericMatrix", "QMatrix3x3", // extends a template type
|
||||
"QLatin1String", "QStringView", // e.g. QColor constructors and QColor::SetNamedColor() overloads. These are usually optional alternatives to QString
|
||||
"QLatin1StringView", // Qt 6 - used in qanystringview
|
||||
"QUtf8StringView", // Qt 6 - used in qdebug
|
||||
"QStringRef", // e.g. QLocale::toLongLong and similar overloads. As above
|
||||
"qfloat16", // e.g. QDataStream - there is no such half-float type in C or Go
|
||||
"char16_t", // e.g. QChar() constructor overload, just unnecessary
|
||||
"char32_t", // e.g. QDebug().operator<< overload, unnecessary
|
||||
"wchar_t", // e.g. qstringview.h overloads, unnecessary
|
||||
"FILE", // e.g. qfile.h constructors
|
||||
"sockaddr", // Qt network Qhostaddress. Should be possible to make this work but may be platform-specific
|
||||
"qInternalCallback", // e.g. qnamespace.h
|
||||
"QGraphicsEffectSource", // e.g. used by qgraphicseffect.h, but the definition is in ????
|
||||
"QXmlStreamEntityDeclarations", // e.g. qxmlstream.h. The class definition was blacklisted for ???? reason so don't allow it as a parameter either
|
||||
"QXmlStreamNamespaceDeclarations", // e.g. qxmlstream.h. As above
|
||||
"QXmlStreamNotationDeclarations", // e.g. qxmlstream.h. As above
|
||||
"QXmlStreamAttributes", // e.g. qxmlstream.h
|
||||
"LineLayout::ValidLevel", // ..
|
||||
"QtMsgType", // e.g. qdebug.h TODO Defined in qlogging.h, but omitted because it's predefined in qglobal.h, and our clangexec is too agressive
|
||||
"QTextStreamFunction", // e.g. qdebug.h
|
||||
"QFactoryInterface", // qfactoryinterface.h
|
||||
"QTextEngine", // used by qtextlayout.h, also blocked in ImportHeaderForClass above
|
||||
"QVulkanInstance", // e.g. qwindow.h. Not tackling vulkan yet
|
||||
"QPlatformNativeInterface", // e.g. QGuiApplication::platformNativeInterface(). Private type, could probably expose as uintptr. n.b. Changes in Qt6
|
||||
"QPlatformBackingStore", // e.g. qbackingstore.h, as below
|
||||
"QPlatformMenuBar", // e.g. qfutureinterface.h, as below
|
||||
"QPlatformOffscreenSurface", // e.g. qoffscreensurface.h, as below
|
||||
"QPlatformPixmap", // e.g. qpixmap.h. as below
|
||||
"QPlatformScreen", // e.g. qscreen.h. as below
|
||||
"QPlatformWindow", // e.g. qwindow.h, as below
|
||||
"QPlatformSurface", // e.g. qsurface.h. as below
|
||||
"QPlatformMenu", // e.g. QMenu_PlatformMenu. Defined in the QPA, could probably expose as uintptr
|
||||
"QPlatformMediaCaptureSession", // Qt 6 Multimedia qmediacapturesession.h
|
||||
"QPlatformMediaRecorder", // Qt 6 Multimedia qmediarecorder.h
|
||||
"QPlatformVideoSink", // Qt 6 Multimedia qvideosink.h
|
||||
"QTextDocument::ResourceProvider", // Qt 6 typedef for unsupported std::function<QVariant(const QUrl&)>
|
||||
"QTransform::Affine", // Qt 6 qtransform.h - public method returning private type
|
||||
"QAbstractAudioBuffer", // Qt 5 Multimedia, this is a private/internal type only
|
||||
"QAbstractVideoBuffer", // Works in Qt 5, but in Qt 6 Multimedia this type is used in qvideoframe.h but is not defined anywhere (it was later added in Qt 6.8)
|
||||
"QRhi", // Qt 6 unstable types, used in Multimedia
|
||||
"QPostEventList", // Qt QCoreApplication: private headers required
|
||||
"QMetaCallEvent", // ..
|
||||
"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
|
||||
"QLatin1StringView", // Qt 6 - used in qanystringview
|
||||
"QUtf8StringView", // Qt 6 - used in qdebug
|
||||
"QStringRef", // e.g. QLocale::toLongLong and similar overloads. As above
|
||||
"qfloat16", // e.g. QDataStream - there is no such half-float type in C or Go
|
||||
"char16_t", // e.g. QChar() constructor overload, just unnecessary
|
||||
"char32_t", // e.g. QDebug().operator<< overload, unnecessary
|
||||
"wchar_t", // e.g. qstringview.h overloads, unnecessary
|
||||
"FILE", // e.g. qfile.h constructors
|
||||
"sockaddr", // Qt network Qhostaddress. Should be possible to make this work but may be platform-specific
|
||||
"qInternalCallback", // e.g. qnamespace.h
|
||||
"QGraphicsEffectSource", // e.g. used by qgraphicseffect.h, but the definition is in ????
|
||||
"QXmlStreamEntityDeclarations", // e.g. qxmlstream.h. The class definition was blacklisted for ???? reason so don't allow it as a parameter either
|
||||
"QXmlStreamNamespaceDeclarations", // e.g. qxmlstream.h. As above
|
||||
"QXmlStreamNotationDeclarations", // e.g. qxmlstream.h. As above
|
||||
"QXmlStreamAttributes", // e.g. qxmlstream.h
|
||||
"LineLayout::ValidLevel", // ..
|
||||
"QtMsgType", // e.g. qdebug.h TODO Defined in qlogging.h, but omitted because it's predefined in qglobal.h, and our clangexec is too agressive
|
||||
"QTextStreamFunction", // e.g. qdebug.h
|
||||
"QFactoryInterface", // qfactoryinterface.h
|
||||
"QTextEngine", // used by qtextlayout.h, also blocked in ImportHeaderForClass above
|
||||
"QVulkanInstance", // e.g. qwindow.h. Not tackling vulkan yet
|
||||
"QPlatformNativeInterface", // e.g. QGuiApplication::platformNativeInterface(). Private type, could probably expose as uintptr. n.b. Changes in Qt6
|
||||
"QPlatformBackingStore", // e.g. qbackingstore.h, as below
|
||||
"QPlatformMenuBar", // e.g. qfutureinterface.h, as below
|
||||
"QPlatformOffscreenSurface", // e.g. qoffscreensurface.h, as below
|
||||
"QPlatformPixmap", // e.g. qpixmap.h. as below
|
||||
"QPlatformScreen", // e.g. qscreen.h. as below
|
||||
"QPlatformWindow", // e.g. qwindow.h, as below
|
||||
"QPlatformSurface", // e.g. qsurface.h. as below
|
||||
"QPlatformMenu", // e.g. QMenu_PlatformMenu. Defined in the QPA, could probably expose as uintptr
|
||||
"QPlatformMediaCaptureSession", // Qt 6 Multimedia qmediacapturesession.h
|
||||
"QPlatformMediaRecorder", // Qt 6 Multimedia qmediarecorder.h
|
||||
"QPlatformVideoSink", // Qt 6 Multimedia qvideosink.h
|
||||
"QTextDocument::ResourceProvider", // Qt 6 typedef for unsupported std::function<QVariant(const QUrl&)>
|
||||
"QTransform::Affine", // Qt 6 qtransform.h - public method returning private type
|
||||
"QAbstractAudioBuffer", // Qt 5 Multimedia, this is a private/internal type only
|
||||
"QAbstractVideoBuffer", // Works in Qt 5, but in Qt 6 Multimedia this type is used in qvideoframe.h but is not defined anywhere (it was later added in Qt 6.8)
|
||||
"QRhi", // Qt 6 unstable types, used in Multimedia
|
||||
"QPostEventList", // Qt QCoreApplication: private headers required
|
||||
"QMetaCallEvent", // ..
|
||||
"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
|
||||
"Konsole::ScreenWindow", // Qt 5 libqtermwidget. This is an internal class, it's in the Git repo but not in the Debian package
|
||||
"Konsole::HistoryType", // Qt 5 libqtermwidget. This is an internal class, it's in the Git repo but not in the Debian package
|
||||
"Konsole::TerminalCharacterDecoder", // Qt 5 libqtermwidget. This is an internal class, it's in the Git repo but not in the Debian package
|
||||
"Konsole::Character", // Qt 5 libqtermwidget. This is an internal class, it's in the Git repo but not in the Debian package
|
||||
"KeyboardTranslator::Command", // Qt 5 libqtermwidget. This works and is present but the namespace lookups are messed up
|
||||
"KeyboardTranslator::Entry", // Qt 5 libqtermwidget. This works and is present but the namespace lookups are messed up
|
||||
"RegExpFilter::HotSpot", // Qt 5 libqtermwidget. This works and is present but the namespace lookups are messed up
|
||||
"Filter::HotSpot", // Qt 5 libqtermwidget. This works and is present but the namespace lookups are messed up
|
||||
|
||||
"____last____":
|
||||
return ErrTooComplex
|
||||
}
|
||||
|
@ -190,6 +190,18 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
||||
(&clangMatchUnderPath{filepath.Join(extraLibsDir, "scintilla")}).Match,
|
||||
)
|
||||
|
||||
generate(
|
||||
"qt-restricted-extras/qtermwidget",
|
||||
[]string{
|
||||
"/usr/include/qtermwidget5",
|
||||
},
|
||||
AllowAllHeaders,
|
||||
clangBin,
|
||||
pkgConfigCflags("qtermwidget5"),
|
||||
outDir,
|
||||
ClangMatchSameHeaderDefinitionOnly,
|
||||
)
|
||||
|
||||
// FLUSH all known typedefs / ...
|
||||
|
||||
flushKnownTypes()
|
||||
|
@ -929,6 +929,8 @@ func emitParametersCabiConstructor(c *CppClass, ctor *CppMethod) string {
|
||||
func emitBindingCpp(src *CppParsedHeader, filename string) (string, error) {
|
||||
ret := strings.Builder{}
|
||||
|
||||
importedHeaders := make(map[string]struct{})
|
||||
|
||||
for _, ref := range getReferencedTypes(src) {
|
||||
|
||||
if ref == "QString" {
|
||||
@ -947,7 +949,29 @@ func emitBindingCpp(src *CppParsedHeader, filename string) (string, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
if cinfo, ok := KnownClassnames[ref]; ok && len(cinfo.HeaderFile) > 0 {
|
||||
// We know exactly which header file we actually found it in
|
||||
// For core Qt classes, #include the <className> directly, as Qt
|
||||
// has helper mini-headers for almost all types which work even
|
||||
// if the headers are restructured in different Qt versions
|
||||
// But for some subpackages they don't offer this
|
||||
|
||||
if cinfo.PackageName == "qt/qtermwidget" {
|
||||
// Wanted
|
||||
ref = cinfo.HeaderFile
|
||||
} else {
|
||||
// Not wanted
|
||||
}
|
||||
}
|
||||
|
||||
// The transform above can cause duplicate imports. Only import them once
|
||||
// Headers usually have #pragma once or equivalent, but this is courteous
|
||||
if _, ok := importedHeaders[ref]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
ret.WriteString(`#include <` + ref + ">\n")
|
||||
importedHeaders[ref] = struct{}{}
|
||||
}
|
||||
|
||||
ret.WriteString(`#include <` + filename + ">\n")
|
||||
|
@ -17,6 +17,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||
qt6-webengine-dev \
|
||||
libqscintilla2-qt5-dev \
|
||||
libqscintilla2-qt6-dev \
|
||||
libqtermwidget5-1-dev \
|
||||
libutf8proc-dev \
|
||||
clang \
|
||||
git \
|
||||
ca-certificates \
|
||||
|
6
qt-restricted-extras/qtermwidget/cflags.go
Normal file
6
qt-restricted-extras/qtermwidget/cflags.go
Normal file
@ -0,0 +1,6 @@
|
||||
package qtermwidget
|
||||
|
||||
/*
|
||||
#cgo pkg-config: qtermwidget5
|
||||
*/
|
||||
import "C"
|
Loading…
x
Reference in New Issue
Block a user