From a5267dbaa22581e316f440dc7327f2e7431012d5 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 13 Jan 2019 11:48:06 +0900 Subject: qt_connection_util.h: a new home for connectSingleShot() and newly made connectUntil() --- lib/connection.h | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'lib/connection.h') diff --git a/lib/connection.h b/lib/connection.h index ff3e2028..98e8dced 100644 --- a/lib/connection.h +++ b/lib/connection.h @@ -21,6 +21,7 @@ #include "csapi/create_room.h" #include "joinstate.h" #include "events/accountdataevents.h" +#include "qt_connection_util.h" #include #include @@ -49,26 +50,6 @@ namespace QMatrixClient class SendToDeviceJob; class SendMessageJob; - /** Create a single-shot connection that triggers on the signal and - * then self-disconnects - * - * Only supports DirectConnection type. - */ - template - inline auto connectSingleShot(SenderT1* sender, SignalT signal, - ReceiverT2* receiver, SlotT slot) - { - QMetaObject::Connection connection; - connection = QObject::connect(sender, signal, receiver, slot, - Qt::DirectConnection); - Q_ASSERT(connection); - QObject::connect(sender, signal, receiver, - [connection] { QObject::disconnect(connection); }, - Qt::DirectConnection); - return connection; - } - class Connection; using room_factory_t = std::function