summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/shared/corecompositor.h
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-11-13 15:40:14 +0100
committerJohan Helsing <johan.helsing@qt.io>2019-05-10 12:35:00 +0000
commit5ec182df699041699f514d164a161c299fde5d19 (patch)
tree5f646078ba391c4327414f532991f8e1f687de59 /tests/auto/client/shared/corecompositor.h
parent811e38787536c65122d780ad3d7b16757bb7d0bb (diff)
Client: Implement primary-selection-unstable-v1
[ChangeLog][QPA plugin] Added support for middle mouse pasting through the primary-selection-unstable-v1 protocol. Fixes: QTBUG-66008 Change-Id: I7c8fb9aa2c856f5b6794aeab1ee75d80cad05dcd Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/client/shared/corecompositor.h')
-rw-r--r--tests/auto/client/shared/corecompositor.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/client/shared/corecompositor.h b/tests/auto/client/shared/corecompositor.h
index 875b7d050..254465ee6 100644
--- a/tests/auto/client/shared/corecompositor.h
+++ b/tests/auto/client/shared/corecompositor.h
@@ -125,6 +125,23 @@ public:
}
/*!
+ * \brief Returns the nth global with the given type, if any
+ */
+ template<typename global_type>
+ global_type *get(int index)
+ {
+ warnIfNotLockedByThread(Q_FUNC_INFO);
+ for (auto *global : qAsConst(m_globals)) {
+ if (auto *casted = qobject_cast<global_type *>(global)) {
+ if (index--)
+ continue;
+ return casted;
+ }
+ }
+ return nullptr;
+ }
+
+ /*!
* \brief Returns all globals with the given type, if any
*/
template<typename global_type>