mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
#2266 AppFwk : Add editor attribute setCurrentIndexWhenItemIsChecked
Fix bug when a selection is active
This commit is contained in:
1 parent
3b9e7d0106
commit
81129302f3
2 files changed
+12
-6
No files matched your search
@@ -573,14 +573,18 @@ void PdmUiTreeSelectionEditor::slotCurrentChanged(const QModelIndex& current, co
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTreeSelectionEditor::slotClicked(const QModelIndex& current)
|
||||
void PdmUiTreeSelectionEditor::slotClicked(const QModelIndex& index)
|
||||
{
|
||||
if (current.isValid())
|
||||
if (m_attributes.setCurrentIndexWhenItemIsChecked && index.isValid())
|
||||
{
|
||||
QVariant v = m_proxyModel->data(current, Qt::CheckStateRole);
|
||||
if (v == Qt::Checked)
|
||||
QModelIndexList selectedIndexes = m_treeView->selectionModel()->selectedIndexes();
|
||||
if (selectedIndexes.size() < 2)
|
||||
{
|
||||
m_treeView->setCurrentIndex(current);
|
||||
QVariant v = m_proxyModel->data(index, Qt::CheckStateRole);
|
||||
if (v == Qt::Checked)
|
||||
{
|
||||
m_treeView->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user