summaryrefslogtreecommitdiffstats
path: root/src/corelib/compat/removed_api.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2023-03-28 10:38:25 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2023-04-04 01:05:47 +0200
commitc080d1e64d6e7c29bedfef48676f753c8bc0259c (patch)
tree801425a7e164e3eb62b370c592357bd37825c7d6 /src/corelib/compat/removed_api.cpp
parent5c4a94ba85f0bed9633c385455685ba364a72540 (diff)
Create any callable using QRunnable::create
The overhead of making new custom classes appears to be less than constructing a generic std::function. [ChangeLog][QtCore][QRunnable] QRunnable::create can now take non-copyable functions as argument. Task-number: QTBUG-112302 Change-Id: Ied870f13ca6c7eaa14ed6eff9c4e676c7b73881c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/compat/removed_api.cpp')
-rw-r--r--src/corelib/compat/removed_api.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp
index fdbe5de41c..e1d9c9eccf 100644
--- a/src/corelib/compat/removed_api.cpp
+++ b/src/corelib/compat/removed_api.cpp
@@ -509,6 +509,13 @@ QByteArray QMessageAuthenticationCode::hash(const QByteArray &msg, const QByteAr
qToByteArrayViewIgnoringNull(key), method);
}
+#include "qrunnable.h"
+
+QRunnable *QRunnable::create(std::function<void()> functionToRun)
+{
+ return QRunnable::create<std::function<void()>>(std::move(functionToRun));
+}
+
#include "qstring.h"
qsizetype QString::toUcs4_helper(const ushort *uc, qsizetype length, uint *out)