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 ...@@ -86,11 +86,7 @@ bool ItemLibrarySection::updateSectionVisibility(const QString &searchText, bool
*changed = false; *changed = false;
QMap<int, ItemLibraryItem*>::const_iterator itemIterator = m_sectionEntries.items().constBegin(); foreach(ItemLibraryItem *itemLibraryItem, m_sectionEntries.items()) {
while (itemIterator != m_sectionEntries.items().constEnd()) {
ItemLibraryItem *itemLibraryItem = itemIterator.value();
bool itemVisible = itemLibraryItem->itemName().toLower().contains(searchText); bool itemVisible = itemLibraryItem->itemName().toLower().contains(searchText);
bool itemChanged = false; bool itemChanged = false;
...@@ -100,8 +96,6 @@ bool ItemLibrarySection::updateSectionVisibility(const QString &searchText, bool ...@@ -100,8 +96,6 @@ bool ItemLibrarySection::updateSectionVisibility(const QString &searchText, bool
if (itemVisible) if (itemVisible)
haveVisibleItems = true; haveVisibleItems = true;
++itemIterator;
} }
m_sectionEntries.resetModel(); m_sectionEntries.resetModel();
...@@ -114,9 +108,8 @@ bool ItemLibrarySection::updateSectionVisibility(const QString &searchText, bool ...@@ -114,9 +108,8 @@ bool ItemLibrarySection::updateSectionVisibility(const QString &searchText, bool
void ItemLibrarySection::updateItemIconSize(const QSize &itemIconSize) void ItemLibrarySection::updateItemIconSize(const QSize &itemIconSize)
{ {
foreach (ItemLibraryItem* itemLibraryItemModel, m_sectionEntries.itemList()) { foreach (ItemLibraryItem* itemLibraryItemModel, m_sectionEntries.items())
itemLibraryItemModel->setItemIconSize(itemIconSize); itemLibraryItemModel->setItemIconSize(itemIconSize);
}
} }
bool ItemLibrarySection::setVisible(bool isVisible) bool ItemLibrarySection::setVisible(bool isVisible)
......
...@@ -85,9 +85,7 @@ static bool compareFunction(QObject *first, QObject *second) ...@@ -85,9 +85,7 @@ static bool compareFunction(QObject *first, QObject *second)
void ItemLibrarySectionModel::addItem(ItemLibraryItem *element, int libId) void ItemLibrarySectionModel::addItem(ItemLibraryItem *element, int libId)
{ {
m_itemList.append(element);
m_itemModels.insert(libId, element);
element->setVisible(true); element->setVisible(true);
} }
...@@ -102,14 +100,9 @@ void ItemLibrarySectionModel::privateRemove(int pos) ...@@ -102,14 +100,9 @@ void ItemLibrarySectionModel::privateRemove(int pos)
m_privList.removeAt(pos); m_privList.removeAt(pos);
} }
const QMap<int, ItemLibraryItem*> &ItemLibrarySectionModel::items() const const QList<ItemLibraryItem *> &ItemLibrarySectionModel::items() const
{
return m_itemModels;
}
const QList<ItemLibraryItem *> ItemLibrarySectionModel::itemList() const
{ {
return m_itemModels.values(); return m_itemList;
} }
void ItemLibrarySectionModel::resetModel() void ItemLibrarySectionModel::resetModel()
......
...@@ -56,8 +56,7 @@ public: ...@@ -56,8 +56,7 @@ public:
void privateInsert(int pos, QObject *item); void privateInsert(int pos, QObject *item);
void privateRemove(int pos); void privateRemove(int pos);
const QMap<int, ItemLibraryItem*> &items() const; const QList<ItemLibraryItem *> &items() const;
const QList<ItemLibraryItem *> itemList() const;
void resetModel(); void resetModel();
...@@ -65,7 +64,7 @@ private: // functions ...@@ -65,7 +64,7 @@ private: // functions
void addRoleNames(); void addRoleNames();
private: // variables private: // variables
QMap<int, ItemLibraryItem*> m_itemModels; QList<ItemLibraryItem*> m_itemList;
QList<QObject *> m_privList; QList<QObject *> m_privList;
QHash<int, QByteArray> m_roleNames; 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