From 7b9ebdcb3b96027d2e15c15d72543bb221bfbe9c Mon Sep 17 00:00:00 2001
From: Thomas Hartmann <Thomas.Hartmann@digia.com>
Date: Fri, 2 Aug 2013 13:15:01 +0200
Subject: [PATCH] QmlDesigner.MetaInfo: adding isView()

This function checks if the type is a view.

Change-Id: I5b333ac18dd8169bc014c92bd04c0faff4f3f72f
Reviewed-by: Marco Bubke <marco.bubke@digia.com>
---
 .../qmldesigner/designercore/include/nodemetainfo.h       | 1 +
 .../qmldesigner/designercore/metainfo/nodemetainfo.cpp    | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h
index c06b72a212e..38a92513b8d 100644
--- a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h
+++ b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h
@@ -99,6 +99,7 @@ public:
     bool isSubclassOf(const TypeName &type, int majorVersion, int minorVersio) const;
 
     bool isLayoutable() const;
+    bool isView() const;
 
     QString importDirectoryPath() const;
 
diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
index a10bfdd988f..52173cb999a 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
@@ -1307,4 +1307,12 @@ bool NodeMetaInfo::isLayoutable() const
     return isSubclassOf("QtQuick.Positioner", -1, -1) || isSubclassOf("QtQuick.Layouts.Layout", -1, -1);
 }
 
+bool NodeMetaInfo::isView() const
+{
+    return isValid() &&
+            (isSubclassOf("QtQuick.ListView", -1, -1) ||
+             isSubclassOf("QtQuick.GridView", -1, -1) ||
+             isSubclassOf("QtQuick.PathView", -1, -1));
+}
+
 } // namespace QmlDesigner
-- 
GitLab