summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-04-04 22:00:38 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-11 11:17:56 +0300
commit0eb00ed700c472f005de35d96c72a9b54cd4c2c2 (patch)
treee6095bc29bf000d5e7c6202ee2142e7310c834fa /core
parentb0e1d8863457441c05f092a39669cf9d64cb6507 (diff)
downloadsubsurface-0eb00ed700c472f005de35d96c72a9b54cd4c2c2.tar.gz
Cleanup: provide our own qOverload<> implementation.
This is only in Qt 5.7 and therefore can't be used in Qt 5.5 and 5.6 builds. Moreover, we can't simply reuse Qt's version owing to licensing concerns. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-rw-r--r--core/qthelper.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/qthelper.h b/core/qthelper.h
index 2cc7dfec4..cbe2b77f0 100644
--- a/core/qthelper.h
+++ b/core/qthelper.h
@@ -116,6 +116,21 @@ void moveInVector(Vector &v, int rangeBegin, int rangeEnd, int destination)
std::rotate(it + destination, it + rangeBegin, it + rangeEnd);
}
+// Qt overloads some signals(!) which can't therefore be used in connect() calls with
+// pointers-to-member functions where the signatures of signal and slot don't match perfectly.
+// For this case, Qt 5.7 provides the qOverload<> helper.
+// Since we still support Qt 5.5 let's reimplement it here.
+#if QT_VERSION < 0x050700
+template <typename... Args>
+struct QOverload {
+ template <typename Ret, typename Class>
+ static Ret (Class::*of(Ret (Class::*fun)(Args...)))(Args...)
+ {
+ return fun;
+ }
+};
+#endif
+
#endif
// 3) Functions visible to C and C++