diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-08-28 15:12:17 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-10-17 19:08:18 +0200 |
commit | b21d14efdfa6730ed408e6e680e83185d62d631f (patch) | |
tree | 0c5b8e1bcb233e5e2642deee5c5a4ce2dd7fe7b2 /sources/pyside6/libpyside/dynamicqmetaobject.cpp | |
parent | d099ba0fb651e91f3fa576599bf2c128adf0e847 (diff) |
libpyside: Implement QMetaMethod::tags() for @Slot
Tags can be used like annotations and are for example
used in the DBus module.
[ChangeLog][PySide6] An optional parameter "tag" has been
added to @Slot, allowing to set QMetaMethod.tag().
Pick-to: 6.6
Fixes: PYSIDE-748
Change-Id: I62bef6179917307471cb72491ac3d05970572f3f
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/dynamicqmetaobject.cpp')
-rw-r--r-- | sources/pyside6/libpyside/dynamicqmetaobject.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sources/pyside6/libpyside/dynamicqmetaobject.cpp b/sources/pyside6/libpyside/dynamicqmetaobject.cpp index b7fbc7661..b41dbc275 100644 --- a/sources/pyside6/libpyside/dynamicqmetaobject.cpp +++ b/sources/pyside6/libpyside/dynamicqmetaobject.cpp @@ -53,7 +53,8 @@ public: const QByteArray &signature) const; int indexOfProperty(const QByteArray &name) const; int addSlot(const QByteArray &signature); - int addSlot(const QByteArray &signature, const QByteArray &type); + int addSlot(const QByteArray &signature, const QByteArray &type, + const QByteArray &tag = {}); int addSignal(const QByteArray &signature); void removeMethod(QMetaMethod::MethodType mtype, int index); int getPropertyNotifyId(PySideProperty *property) const; @@ -211,7 +212,8 @@ int MetaObjectBuilder::addSlot(const char *signature) } int MetaObjectBuilderPrivate::addSlot(const QByteArray &signature, - const QByteArray &type) + const QByteArray &type, + const QByteArray &tag) { if (!checkMethodSignature(signature)) return -1; @@ -219,6 +221,8 @@ int MetaObjectBuilderPrivate::addSlot(const QByteArray &signature, QMetaMethodBuilder methodBuilder = ensureBuilder()->addSlot(signature); if (!type.isEmpty() && type != "void"_ba) methodBuilder.setReturnType(type); + if (!tag.isEmpty()) + methodBuilder.setTag(tag); return m_baseObject->methodCount() + methodBuilder.index(); } @@ -638,7 +642,7 @@ void MetaObjectBuilderPrivate::parsePythonType(PyTypeObject *type) const auto *entryList = PySide::Slot::dataListFromCapsule(capsule); for (const auto &e : *entryList) { if (m_baseObject->indexOfSlot(e.signature) == -1) - addSlot(e.signature, e.resultType); + addSlot(e.signature, e.resultType, e.tag); } } } |