aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-10-04 11:07:47 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-10-04 11:07:47 +0200
commitdf5606ebd360d753b6261133254408aadbbb7f7f (patch)
treec8268b230339bc88863b4ffbc42ae72ed87ad424
parent677c73263f434d1564695a8128d75fefd1a7b50b (diff)
downloadlibquotient-df5606ebd360d753b6261133254408aadbbb7f7f.tar.gz
libquotient-df5606ebd360d753b6261133254408aadbbb7f7f.zip
Make connectSingleShot() a tiny wrapper on Qt 6
Qt 6 has Qt::SingleShotConnection; connectSingleShot remains just for the sake of compatibility across Qt 5 and Qt 6. If you target Qt 6 only, feel free to use the Qt facility directly.
-rw-r--r--lib/qt_connection_util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/qt_connection_util.h b/lib/qt_connection_util.h
index ffefb2a2..46294499 100644
--- a/lib/qt_connection_util.h
+++ b/lib/qt_connection_util.h
@@ -106,6 +106,11 @@ inline auto connectSingleShot(SenderT* sender, SignalT signal,
ContextT* context, const FunctorT& slot,
Qt::ConnectionType connType = Qt::AutoConnection)
{
+#if QT_VERSION_MAJOR >= 6
+ return QObject::connect(sender, signal, context, slot,
+ Qt::ConnectionType(connType
+ | Qt::SingleShotConnection));
+#else
return _impl::connectSingleShot(
sender, signal, context, _impl::wrap_in_function(slot), connType);
}
@@ -125,6 +130,7 @@ inline auto connectSingleShot(SenderT* sender, SignalT signal,
(receiver->*slot)(args...);
}),
connType);
+#endif
}
/*! \brief A guard pointer that disconnects an interested object upon destruction