mirror of
https://github.com/mappu/miqt.git
synced 2025-01-03 14:18:37 +00:00
genbindings: rely entirely on typedefs for QList<> handling
This commit is contained in:
parent
3b65e1fc6f
commit
4df990b345
@ -689,24 +689,6 @@ func parseSingleTypeString(p string) CppParameter {
|
|||||||
insert.Pointer = true
|
insert.Pointer = true
|
||||||
insert.PointerCount++
|
insert.PointerCount++
|
||||||
|
|
||||||
} else if len(tok) > 4 && strings.HasSuffix(tok, "List") {
|
|
||||||
// Classes ending in --List are usually better represented as a QList
|
|
||||||
// type directly, so that the binding uses proper Go slices
|
|
||||||
// Typedef e.g. QObjectList
|
|
||||||
insert.TypeAlias = tok
|
|
||||||
switch tok {
|
|
||||||
case "QStringList", "QModelIndexList", "QVariantList", "QFileInfoList":
|
|
||||||
// These types are defined as a QList of values
|
|
||||||
insert.ParameterType += " QList<" + tok[0:len(tok)-4] + ">"
|
|
||||||
case "QTextList":
|
|
||||||
// This is really a custom class, preserve as-is
|
|
||||||
insert.ParameterType += " " + tok
|
|
||||||
default:
|
|
||||||
// These types are defined as a QList of pointers.
|
|
||||||
// QList<QFoo*>. This is the most common case
|
|
||||||
insert.ParameterType += " QList<" + tok[0:len(tok)-4] + " *>"
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Valid part of the type name
|
// Valid part of the type name
|
||||||
if tok == "char" && isSigned {
|
if tok == "char" && isSigned {
|
||||||
|
@ -25,6 +25,9 @@ func init() {
|
|||||||
// @ref https://doc.qt.io/qt-5/qprocess.html#Q_PID-typedef
|
// @ref https://doc.qt.io/qt-5/qprocess.html#Q_PID-typedef
|
||||||
KnownTypedefs["Q_PID"] = CppTypedef{"WId", parseSingleTypeString("uintptr_t")}
|
KnownTypedefs["Q_PID"] = CppTypedef{"WId", parseSingleTypeString("uintptr_t")}
|
||||||
|
|
||||||
|
// QString is deleted from this binding
|
||||||
|
KnownTypedefs["QStringList"] = CppTypedef{"QStringList", parseSingleTypeString("QList<QString>")}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type CppParameter struct {
|
type CppParameter struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user