forked from qt-creator/qt-creator
QmlDesigner: Add flow mode to ItemLibrary
If in flow mode we only show FlowItems. Change-Id: I7d41155eac8bc180c7ac1d0092b35d7fc3f9be91 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -64,6 +64,13 @@ void ItemLibraryModel::setExpanded(bool expanded, const QString §ion)
|
||||
collapsedStateHash.insert(section, expanded);
|
||||
}
|
||||
|
||||
void ItemLibraryModel::setFlowMode(bool b)
|
||||
{
|
||||
m_flowMode = b;
|
||||
bool changed;
|
||||
updateVisibility(&changed);
|
||||
}
|
||||
|
||||
ItemLibraryModel::ItemLibraryModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
@@ -187,6 +194,12 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
|
||||
|
||||
bool forceVisiblity = valid && NodeHints::fromItemLibraryEntry(entry).visibleInLibrary();
|
||||
|
||||
if (m_flowMode) {
|
||||
forceVisiblity = false;
|
||||
isItem = metaInfo.isSubclassOf("FlowView.FlowItem");
|
||||
}
|
||||
|
||||
|
||||
if (valid
|
||||
&& (isItem || forceVisiblity) //We can change if the navigator does support pure QObjects
|
||||
&& (entry.requiredImport().isEmpty()
|
||||
@@ -262,6 +275,10 @@ void ItemLibraryModel::updateVisibility(bool *changed)
|
||||
bool sectionChanged = false;
|
||||
bool sectionVisibility = itemLibrarySection->updateSectionVisibility(sectionSearchText,
|
||||
§ionChanged);
|
||||
|
||||
if (m_flowMode && itemLibrarySection->sectionName() != "My QML Components")
|
||||
sectionVisibility= false;
|
||||
|
||||
*changed |= sectionChanged;
|
||||
*changed |= itemLibrarySection->setVisible(sectionVisibility);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user