mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3249 caf: Add isSelected method to selection manager
This commit is contained in:
parent
ed518a94a6
commit
99bdece40e
@ -209,6 +209,33 @@ void SelectionManager::setSelectionFromReferences(const std::vector<QString>& re
|
||||
setSelectedItems(uiItems, selectionLevel);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool SelectionManager::isSelected(PdmUiItem* item, int selectionLevel) const
|
||||
{
|
||||
auto levelIter = m_selectionPrLevel.find(selectionLevel);
|
||||
|
||||
if (levelIter == m_selectionPrLevel.end()) return false;
|
||||
|
||||
const std::vector< std::pair<PdmPointer<PdmObjectHandle>, PdmUiItem*> >& selection = levelIter->second;
|
||||
|
||||
auto iter = selection.begin();
|
||||
while ( iter != selection.end() )
|
||||
{
|
||||
if ( iter->second == item )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -87,6 +87,8 @@ public:
|
||||
void selectionAsReferences(std::vector<QString>& referenceList, int selectionLevel = 0) const;
|
||||
void setSelectionFromReferences(const std::vector<QString>& referenceList, int selectionLevel = 0);
|
||||
|
||||
bool isSelected(PdmUiItem* item, int selectionLevel) const;
|
||||
|
||||
void clearAll();
|
||||
void clear(int selectionLevel);
|
||||
void removeObjectFromAllSelections(PdmObjectHandle* pdmObject);
|
||||
|
Loading…
Reference in New Issue
Block a user