mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
AppFwk TableEditor : Add selection of owner object
If no objects in the table is selected, add the owner object to selection. This makes it possible to access the owner object from features to add new items into empty tables.
This commit is contained in:
parent
2c55506a9b
commit
b79a340333
@ -190,6 +190,8 @@ void PdmUiTableViewEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
m_tableView->resizeRowsToContents();
|
||||
m_previousFieldHandle = childArrayFH;
|
||||
}
|
||||
|
||||
updateSelectionManagerFromTableSelection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -310,6 +312,14 @@ void PdmUiTableViewEditor::updateSelectionManagerFromTableSelection()
|
||||
|
||||
std::vector<PdmUiItem*> items { selectedRowObjects.begin(), selectedRowObjects.end() };
|
||||
|
||||
if (items.empty() && childArrayFieldHandle() && childArrayFieldHandle()->ownerObject())
|
||||
{
|
||||
// If no rows are selected, add the owner object to the selection.
|
||||
// This enables features to retrieve the owner object to add of new objects into
|
||||
// an empty table or table without selection
|
||||
items.push_back(childArrayFieldHandle()->ownerObject()->uiCapability());
|
||||
}
|
||||
|
||||
m_isBlockingSelectionManagerChanged = true;
|
||||
SelectionManager::instance()->setSelectedItems(items, m_selectionRole);
|
||||
m_isBlockingSelectionManagerChanged = false;
|
||||
|
Loading…
Reference in New Issue
Block a user