aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/shared/visualtestutil.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/shared/visualtestutil.h')
-rw-r--r--tests/auto/shared/visualtestutil.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/shared/visualtestutil.h b/tests/auto/shared/visualtestutil.h
index 215a487b..76c44821 100644
--- a/tests/auto/shared/visualtestutil.h
+++ b/tests/auto/shared/visualtestutil.h
@@ -127,6 +127,20 @@ namespace QQuickVisualTestUtil
QQuickItem* findViewDelegateItem(QQuickItemView *itemView, int index,
FindViewDelegateItemFlags flags = FindViewDelegateItemFlag::PositionViewAtIndex);
+ /*!
+ \internal
+
+ Same as above except allows use in QTRY_* functions without having to call it again
+ afterwards to assign the delegate.
+ */
+ template<typename T>
+ bool findViewDelegateItem(QQuickItemView *itemView, int index, T &delegateItem,
+ FindViewDelegateItemFlags flags = FindViewDelegateItemFlag::PositionViewAtIndex)
+ {
+ delegateItem = qobject_cast<T>(findViewDelegateItem(itemView, index, flags));
+ return delegateItem != nullptr;
+ }
+
class QQuickApplicationHelper
{
public: