VirtualBox

Changeset 101691 in vbox


Ignore:
Timestamp:
Oct 31, 2023 4:03:38 PM (15 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: A bit of cleanup for tree-view UISettingsSelector.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.cpp

    r101563 r101691  
    616616            if (UISelectorTreeViewItem *pItem = indexToItem(specifiedIndex))
    617617                return pItem->id();
    618             return QUuid();
     618            return 0;
    619619        }
    620620        case R_ItemPixmap:
     
    990990{
    991991    int iID = -1;
    992     const QModelIndex currentIndex = m_pTreeView->currentIndex();
    993     if (currentIndex.isValid())
    994         iID = m_pModel->data(currentIndex, UISelectorModel::R_ItemId).toString().toInt();
     992    const QModelIndex index = m_pTreeView->currentIndex();
     993    if (index.isValid())
     994        iID = m_pModel->data(index, UISelectorModel::R_ItemId).toString().toInt();
    995995    return iID;
    996996}
     
    999999{
    10001000    int iID = -1;
    1001     const QModelIndex specifiedIndex = m_pModel->findItem(strLink);
    1002     if (specifiedIndex.isValid())
    1003         iID = m_pModel->data(specifiedIndex, UISelectorModel::R_ItemId).toString().toInt();
     1001    const QModelIndex index = m_pModel->findItem(strLink);
     1002    if (index.isValid())
     1003        iID = m_pModel->data(index, UISelectorModel::R_ItemId).toString().toInt();
    10041004    return iID;
    10051005}
     
    10071007void UISettingsSelectorTreeView::selectById(int iID)
    10081008{
    1009     const QModelIndex specifiedIndex = m_pModel->findItem(iID);
    1010     if (specifiedIndex.isValid())
    1011         m_pTreeView->setCurrentIndex(specifiedIndex);
    1012 }
    1013 
    1014 void UISettingsSelectorTreeView::sltHandleCurrentChanged(const QModelIndex &currentIndex,
     1009    const QModelIndex index = m_pModel->findItem(iID);
     1010    if (index.isValid())
     1011        m_pTreeView->setCurrentIndex(index);
     1012}
     1013
     1014void UISettingsSelectorTreeView::sltHandleCurrentChanged(const QModelIndex &index,
    10151015                                                         const QModelIndex & /* previousIndex */)
    10161016{
    1017     if (currentIndex.isValid())
    1018     {
    1019         const int iID = m_pModel->data(currentIndex, UISelectorModel::R_ItemId).toString().toInt();
     1017    if (index.isValid())
     1018    {
     1019        const int iID = m_pModel->data(index, UISelectorModel::R_ItemId).toString().toInt();
    10201020        Assert(iID >= 0);
    10211021        emit sigCategoryChanged(iID);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.h

    r101563 r101691  
    185185    /** Holds the tree-view instance. */
    186186    UISelectorTreeView *m_pTreeView;
    187     /** Holds the tree-view instance. */
     187    /** Holds the model instance. */
    188188    UISelectorModel    *m_pModel;
    189189};
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