VirtualBox

Changeset 100419 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 6, 2023 5:40:11 PM (17 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9080. bugref:6699. Some cleaning.

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  
    7474        return;
    7575    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;
    8576}
    8677
     
    8980    qDeleteAll(m_childItems);
    9081    m_childItems.clear();
    91     m_childMap.clear();
    9282    m_bIsOpened = false;
    9383}
     
    10090UICustomFileSystemItem *UICustomFileSystemItem::child(const QString &fileObjectName) const
    10191{
    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;
    10596}
    10697
     
    124115        return;
    125116    m_childItems.removeAt(iIndex);
    126     m_childMap.remove(pItem->fileObjectName());
    127117    delete pItem;
    128118    pItem = 0;
     
    161151        return;
    162152    m_itemData[static_cast<UICustomFileSystemModelData>(index)] = data;
    163     if (static_cast<UICustomFileSystemModelData>(index) == UICustomFileSystemModelData_Name && parentItem())
    164         parentItem()->childRenamed();
    165153}
    166154
     
    206194    qDeleteAll(m_childItems);
    207195    m_childItems.clear();
    208     m_childMap.clear();
    209196}
    210197
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h

    r100418 r100419  
    119119
    120120    void appendChild(UICustomFileSystemItem *child);
    121     void childRenamed();
    122121    QList<UICustomFileSystemItem*>         m_childItems;
    123     /** Used to find children by file object name */
    124     QMap<QString, UICustomFileSystemItem*> m_childMap;
    125122    QMap<UICustomFileSystemModelData, QVariant>  m_itemData;
    126123    UICustomFileSystemItem *m_parentItem;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette