From f2d32a583329b73f10830a539a4fc48a06cb4835 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 21 Sep 2017 20:10:52 +0200 Subject: [PATCH] #1925 Tree Selection Editor : Do not change toggle state if list is empty --- .../cafPdmUiTreeSelectionEditor.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp index 0d8540482a..5e07b5d731 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp @@ -191,17 +191,20 @@ void PdmUiTreeSelectionEditor::configureAndUpdateUi(const QString& uiConfigName) } else { - bool allItemsChecked = true; QModelIndexList indices = allVisibleSourceModelIndices(); - for (auto mi : indices) + if (indices.size() > 0) { - if (m_model->data(mi, Qt::CheckStateRole).toBool() == false) + bool allItemsChecked = true; + for (auto mi : indices) { - allItemsChecked = false; + if (m_model->data(mi, Qt::CheckStateRole).toBool() == false) + { + allItemsChecked = false; + } } - } - m_toggleAllCheckBox->setChecked(allItemsChecked); + m_toggleAllCheckBox->setChecked(allItemsChecked); + } } } }