#12075 When activating an item, also select the item

This commit is contained in:
Magne Sjaastad 2025-01-16 17:51:20 +01:00
parent d17ecc4345
commit 533885239d
3 changed files with 11 additions and 15 deletions

View File

@ -1290,10 +1290,9 @@ void RiuSummaryVectorSelectionUi::defineEditorAttribute( const caf::PdmFieldHand
{
if ( &m_selectedSummaryCategories == field )
{
attrib->currentIndexFieldHandle = &m_currentSummaryCategory;
attrib->showTextFilter = false;
attrib->showToggleAllCheckbox = false;
attrib->setCurrentIndexWhenItemIsChecked = true;
attrib->currentIndexFieldHandle = &m_currentSummaryCategory;
attrib->showTextFilter = false;
attrib->showToggleAllCheckbox = false;
}
// All tree selection editors are set in specified selection mode

View File

@ -354,8 +354,6 @@ QWidget* PdmUiTreeSelectionEditor::createEditorWidget( QWidget* parent )
headerLayout->setContentsMargins( 0, 0, 0, 0 );
layout->addLayout( headerLayout );
PdmUiTreeSelectionEditorAttribute attrib;
m_toggleAllCheckBox = new QCheckBox();
headerLayout->addWidget( m_toggleAllCheckBox );
@ -715,7 +713,7 @@ void PdmUiTreeSelectionEditor::slotClicked( const QModelIndex& index )
return;
}
if ( m_attributes.setCurrentIndexWhenItemIsChecked && index.isValid() )
if ( index.isValid() )
{
QModelIndexList selectedIndexes = m_treeView->selectionModel()->selectedIndexes();
if ( selectedIndexes.size() < 2 )
@ -723,6 +721,7 @@ void PdmUiTreeSelectionEditor::slotClicked( const QModelIndex& index )
QVariant v = m_proxyModel->data( index, Qt::CheckStateRole );
if ( v == Qt::Checked )
{
// Make sure the activated item also is selected in the tree view
m_treeView->setCurrentIndex( index );
}
}

View File

@ -63,7 +63,6 @@ public:
bool showTextFilter;
bool showToggleAllCheckbox;
bool singleSelectionMode;
bool setCurrentIndexWhenItemIsChecked;
bool showCheckBoxes;
bool showContextMenu;
int heightHint;
@ -77,13 +76,12 @@ public:
public:
PdmUiTreeSelectionEditorAttribute()
{
showTextFilter = true;
showToggleAllCheckbox = true;
singleSelectionMode = false;
setCurrentIndexWhenItemIsChecked = false;
showCheckBoxes = true;
showContextMenu = true;
heightHint = -1;
showTextFilter = true;
showToggleAllCheckbox = true;
singleSelectionMode = false;
showCheckBoxes = true;
showContextMenu = true;
heightHint = -1;
currentIndexFieldHandle = nullptr;
}