diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2024-08-27 10:11:06 -0700 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2024-09-30 15:08:37 -0700 |
| commit | 268006ee2f7c5f736ed3d16cdf126fdb28a9dc3b (patch) | |
| tree | 93e3f021b1d66236460a34908cfcd850c27db6fa /src/corelib/kernel/qobject.cpp | |
| parent | da4a6cf78ff42a4f69c2775997ff174ef647f3f3 (diff) | |
QArgumentType: store a QMetaType instead of an id
This would avoid an indirection through the QMetaType constructor. But
I'm also making it so effectively we either have valid QMetaTypes or we
don't. If it can be looked up in the constructor, then string
comparisons aren't necessary at all.
Change-Id: I9a3b2a1a781c27c7271afffd3e5acbca06632476
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
| -rw-r--r-- | src/corelib/kernel/qobject.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 188cfd28a02..36505fae62f 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -101,13 +101,14 @@ static int *queuedConnectionTypes(const QMetaMethod &method) return typeIds; } +// ### Future work: replace with an array of QMetaType or QtPrivate::QMetaTypeInterface * static int *queuedConnectionTypes(const QArgumentType *argumentTypes, int argc) { auto types = std::make_unique<int[]>(argc + 1); for (int i = 0; i < argc; ++i) { const QArgumentType &type = argumentTypes[i]; - if (type.type()) - types[i] = type.type(); + if (type.metaType().isValid()) + types[i] = type.metaType().id(); else if (type.name().endsWith('*')) types[i] = QMetaType::VoidStar; else @@ -3059,6 +3060,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign return QMetaObject::Connection(nullptr); } + // ### Future work: attempt get the metatypes from the meta object first + // because it's possible they're all registered. int *types = nullptr; if ((type == Qt::QueuedConnection) && !(types = queuedConnectionTypes(signalTypes.constData(), signalTypes.size()))) { |
