Changeset 101691 in vbox
- Timestamp:
- Oct 31, 2023 4:03:38 PM (15 months ago)
- 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 616 616 if (UISelectorTreeViewItem *pItem = indexToItem(specifiedIndex)) 617 617 return pItem->id(); 618 return QUuid();618 return 0; 619 619 } 620 620 case R_ItemPixmap: … … 990 990 { 991 991 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(); 995 995 return iID; 996 996 } … … 999 999 { 1000 1000 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(); 1004 1004 return iID; 1005 1005 } … … 1007 1007 void UISettingsSelectorTreeView::selectById(int iID) 1008 1008 { 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 1014 void UISettingsSelectorTreeView::sltHandleCurrentChanged(const QModelIndex &index, 1015 1015 const QModelIndex & /* previousIndex */) 1016 1016 { 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(); 1020 1020 Assert(iID >= 0); 1021 1021 emit sigCategoryChanged(iID); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.h
r101563 r101691 185 185 /** Holds the tree-view instance. */ 186 186 UISelectorTreeView *m_pTreeView; 187 /** Holds the tree-viewinstance. */187 /** Holds the model instance. */ 188 188 UISelectorModel *m_pModel; 189 189 };
Note:
See TracChangeset
for help on using the changeset viewer.