Changeset 100419 in vbox for trunk/src/VBox
- Timestamp:
- Jul 6, 2023 5:40:11 PM (17 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.cpp
r100418 r100419 74 74 return; 75 75 m_childItems.append(item); 76 m_childMap.insert(item->fileObjectName(), item);77 }78 79 void UICustomFileSystemItem::childRenamed()80 {81 /* Recreate child map to accomadate the new file object name of the children: */82 m_childMap.clear();83 foreach(UICustomFileSystemItem* pItem, m_childItems)84 m_childMap[pItem->fileObjectName()] = pItem;85 76 } 86 77 … … 89 80 qDeleteAll(m_childItems); 90 81 m_childItems.clear(); 91 m_childMap.clear();92 82 m_bIsOpened = false; 93 83 } … … 100 90 UICustomFileSystemItem *UICustomFileSystemItem::child(const QString &fileObjectName) const 101 91 { 102 if (!m_childMap.contains(fileObjectName)) 103 return 0; 104 return m_childMap.value(fileObjectName); 92 foreach (UICustomFileSystemItem *pItem, m_childItems) 93 if (pItem && pItem->fileObjectName() == fileObjectName) 94 return pItem; 95 return 0; 105 96 } 106 97 … … 124 115 return; 125 116 m_childItems.removeAt(iIndex); 126 m_childMap.remove(pItem->fileObjectName());127 117 delete pItem; 128 118 pItem = 0; … … 161 151 return; 162 152 m_itemData[static_cast<UICustomFileSystemModelData>(index)] = data; 163 if (static_cast<UICustomFileSystemModelData>(index) == UICustomFileSystemModelData_Name && parentItem())164 parentItem()->childRenamed();165 153 } 166 154 … … 206 194 qDeleteAll(m_childItems); 207 195 m_childItems.clear(); 208 m_childMap.clear();209 196 } 210 197 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h
r100418 r100419 119 119 120 120 void appendChild(UICustomFileSystemItem *child); 121 void childRenamed();122 121 QList<UICustomFileSystemItem*> m_childItems; 123 /** Used to find children by file object name */124 QMap<QString, UICustomFileSystemItem*> m_childMap;125 122 QMap<UICustomFileSystemModelData, QVariant> m_itemData; 126 123 UICustomFileSystemItem *m_parentItem;
Note:
See TracChangeset
for help on using the changeset viewer.