From 184a9d15441eb899f3c23cda1499ab8af9bdf77f Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 3 Jun 2016 14:31:50 +0200 Subject: [PATCH] QmlDesigner: Hide items in the item library which are not a QtQuick.Item Typically this is the result of a bug in the QML code model. There is no reason to show those items in the library. Once we start support pure QObjects we can add a flag to the .metainfo file which shows pure QObjects. Change-Id: Id3688ff23161a410dde421406eada3be4982151e Reviewed-by: Tim Jenssen --- .../components/itemlibrary/itemlibrarymodel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp index 3bfc4550224..798ffa68e81 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp @@ -152,8 +152,17 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model) NodeMetaInfo metaInfo = model->metaInfo(entry.typeName()); bool valid = metaInfo.isValid() && metaInfo.majorVersion() == entry.majorVersion(); + bool isItem = metaInfo.isSubclassOf("QtQuick.Item"); + + if (valid && isItem) { + qDebug() << Q_FUNC_INFO << metaInfo.typeName() << "is not a QtQuick.Item"; + foreach (const NodeMetaInfo &superClass, metaInfo.superClasses()) { + qDebug() << superClass.typeName(); + } + } if (valid + && isItem //We can change if the navigator does support pure QObjects && (entry.requiredImport().isEmpty() || model->hasImport(entryToImport(entry), true, true))) { QString itemSectionName = entry.category();