Commit c4e773a3 authored by Marco Bubke's avatar Marco Bubke Committed by Tim Jenssen
Browse files

QmlDesigner: Change QMap in QList in ItemLibrarySectionModel



Change-Id: I5f221f9062a127e859ea77b875cab65affdd3ba2
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 6b577c9a
......@@ -86,11 +86,7 @@ bool ItemLibrarySection::updateSectionVisibility(const QString &searchText, bool
*changed = false;
QMap<int, ItemLibraryItem*>::const_iterator itemIterator = m_sectionEntries.items().constBegin();
while (itemIterator != m_sectionEntries.items().constEnd()) {
ItemLibraryItem *itemLibraryItem = itemIterator.value();
foreach(ItemLibraryItem *itemLibraryItem, m_sectionEntries.items()) {
bool itemVisible = itemLibraryItem->itemName().toLower().contains(searchText);
bool itemChanged = false;
......@@ -100,8 +96,6 @@ bool ItemLibrarySection::updateSectionVisibility(const QString &searchText, bool
if (itemVisible)
haveVisibleItems = true;
++itemIterator;
}
m_sectionEntries.resetModel();
......@@ -114,9 +108,8 @@ bool ItemLibrarySection::updateSectionVisibility(const QString &searchText, bool
void ItemLibrarySection::updateItemIconSize(const QSize &itemIconSize)
{
foreach (ItemLibraryItem* itemLibraryItemModel, m_sectionEntries.itemList()) {
foreach (ItemLibraryItem* itemLibraryItemModel, m_sectionEntries.items())
itemLibraryItemModel->setItemIconSize(itemIconSize);
}
}
bool ItemLibrarySection::setVisible(bool isVisible)
......
......@@ -85,9 +85,7 @@ static bool compareFunction(QObject *first, QObject *second)
void ItemLibrarySectionModel::addItem(ItemLibraryItem *element, int libId)
{
m_itemModels.insert(libId, element);
m_itemList.append(element);
element->setVisible(true);
}
......@@ -102,14 +100,9 @@ void ItemLibrarySectionModel::privateRemove(int pos)
m_privList.removeAt(pos);
}
const QMap<int, ItemLibraryItem*> &ItemLibrarySectionModel::items() const
{
return m_itemModels;
}
const QList<ItemLibraryItem *> ItemLibrarySectionModel::itemList() const
const QList<ItemLibraryItem *> &ItemLibrarySectionModel::items() const
{
return m_itemModels.values();
return m_itemList;
}
void ItemLibrarySectionModel::resetModel()
......
......@@ -56,8 +56,7 @@ public:
void privateInsert(int pos, QObject *item);
void privateRemove(int pos);
const QMap<int, ItemLibraryItem*> &items() const;
const QList<ItemLibraryItem *> itemList() const;
const QList<ItemLibraryItem *> &items() const;
void resetModel();
......@@ -65,7 +64,7 @@ private: // functions
void addRoleNames();
private: // variables
QMap<int, ItemLibraryItem*> m_itemModels;
QList<ItemLibraryItem*> m_itemList;
QList<QObject *> m_privList;
QHash<int, QByteArray> m_roleNames;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment