diff options
author | David Faure <[email protected]> | 2022-04-29 17:20:42 +0200 |
---|---|---|
committer | David Faure <[email protected]> | 2022-05-10 15:20:57 +0200 |
commit | 3bc80195dfc683387ae438ad0bdfdd19b3adb037 (patch) | |
tree | e72384391ba9af43b163f1e6aae36d181e98aeb4 /src/gui/text/qabstracttextdocumentlayout.cpp | |
parent | b51712f136a6dd0ee60e99b203a0cb14d9272538 (diff) |
QWidgetTextControl: port to new-style connects (faster)
This speeds up creating a QGraphicsTextItem by 14% in an optimized build
Before: 0.070 msecs per iteration
After: 0.060 msecs per iteration
Those connects were showing up when profiling, because of the string
parsing that is necessary when using SIGNAL/SLOT macros.
The stacktrace was connect() => decodeMethodSignature() => argumentTypesFromString()
=> QArgumentType constructor => qMetaTypeInternal(const char*).
Pick-to: 6.3 6.2 5.15
Change-Id: I3cf5655c5450f121005140bdb587fafa083cce6a
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src/gui/text/qabstracttextdocumentlayout.cpp')
-rw-r--r-- | src/gui/text/qabstracttextdocumentlayout.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp index 90726100e23..1a0d045f42d 100644 --- a/src/gui/text/qabstracttextdocumentlayout.cpp +++ b/src/gui/text/qabstracttextdocumentlayout.cpp @@ -435,7 +435,8 @@ void QAbstractTextDocumentLayout::registerHandler(int objectType, QObject *compo if (!iface) return; // ### print error message on terminal? - connect(component, SIGNAL(destroyed(QObject*)), this, SLOT(_q_handlerDestroyed(QObject*))); + QObjectPrivate::connect(component, &QObject::destroyed, d, + &QAbstractTextDocumentLayoutPrivate::_q_handlerDestroyed); QTextObjectHandler h; h.iface = iface; @@ -456,7 +457,8 @@ void QAbstractTextDocumentLayout::unregisterHandler(int objectType, QObject *com const auto it = d->handlers.constFind(objectType); if (it != d->handlers.cend() && (!component || component == it->component)) { if (component) - disconnect(component, SIGNAL(destroyed(QObject*)), this, SLOT(_q_handlerDestroyed(QObject*))); + QObjectPrivate::disconnect(component, &QObject::destroyed, d, + &QAbstractTextDocumentLayoutPrivate::_q_handlerDestroyed); d->handlers.erase(it); } } |