QmlDesigner: Do not show items not available fot QtForMCU

Change-Id: Ia61634a5108db51b49241fd58b73ab71e9e5e2e8
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Thomas Hartmann
2020-08-31 20:03:34 +02:00
parent b0c47267d8
commit 71202abcbc

View File

@@ -33,6 +33,9 @@
#include <nodehints.h> #include <nodehints.h>
#include <nodemetainfo.h> #include <nodemetainfo.h>
#include <designdocument.h>
#include <qmldesignerplugin.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -197,11 +200,47 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
forceVisiblity = isItem; forceVisiblity = isItem;
} }
DesignDocument *designDocument = QmlDesignerPlugin::instance()
->documentManager()
.currentDesignDocument();
if (valid if (designDocument && designDocument->isQtForMCUsProject()) {
&& (isItem || forceVisiblity) //We can change if the navigator does support pure QObjects const QList<TypeName> blockTypes = {"QtQuick.AnimatedImage",
&& (entry.requiredImport().isEmpty() "QtQuick.BorderImage",
|| model->hasImport(entryToImport(entry), true, true))) { "QtQuick.FocusScope",
"QtQuick.TextInput",
"QtQuick.TextEdit",
"QtQuick.Flow",
"QtQuick.Grid",
"QtQuick.GridView",
"QtQuick.Controls.ButtonGroup",
"QtQuick.Controls",
"QtQuick.Controls.Container",
"QtQuick.Controls.DelayButton",
"QtQuick.Controls.ComboBox",
"QtQuick.Controls.Frame",
"QtQuick.Controls.GroupBox",
"QtQuick.Controls.ItemDelegate",
"QtQuick.Controls.SpinBox",
"QtQuick.Controls.RadioDelegate",
"QtQuick.Controls.RoundButton",
"QtQuick.Controls.ScrollView",
"QtQuick.Controls.RangeSlider",
"QtQuick.Controls.ToolBar",
"QtQuick.Controls.TooButton",
"QtQuick.Controls.TabBar",
"QtQuick.Controls.TabButton",
"QtQuick.Controls.SwitchDelegate",
"QtQuick.Controls.TextArea",
"QtQuick.Controls.TextField"};
if (blockTypes.contains(entry.typeName()))
valid = false;
}
if (valid && (isItem || forceVisiblity) //We can change if the navigator does support pure QObjects
&& (entry.requiredImport().isEmpty()
|| model->hasImport(entryToImport(entry), true, true))) {
QString itemSectionName = entry.category(); QString itemSectionName = entry.category();
qCInfo(itemlibraryPopulate) << "Adding:" << entry.typeName() << "to:" << entry.category(); qCInfo(itemlibraryPopulate) << "Adding:" << entry.typeName() << "to:" << entry.category();
ItemLibrarySection *sectionModel = sectionByName(itemSectionName); ItemLibrarySection *sectionModel = sectionByName(itemSectionName);