forked from qt-creator/qt-creator
JsonFieldPage: Be more paranoid with the index of ComboBoxes
This avoids a combobox being shown without any selection. This has the side-effect that QTCREATORBUG-14699 can no longer get triggered. Task-number: QTCREATORBUG-14699 Change-Id: I98f5ae503d29370ad46c6620238bc2815c024747 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -820,13 +820,15 @@ void JsonFieldPage::ComboBoxField::initializeData(MacroExpander *expander)
|
||||
if (!tmpConditions.at(i)) {
|
||||
tmpItems.removeAt(i);
|
||||
tmpData.removeAt(i);
|
||||
if (i <= index)
|
||||
if (i < index && index > 0)
|
||||
--index;
|
||||
}
|
||||
}
|
||||
|
||||
if (index < 0 || index >= tmpData.count())
|
||||
index = 0;
|
||||
w->setItems(tmpItems, tmpData);
|
||||
w->setInsertPolicy(QComboBox::NoInsert);
|
||||
|
||||
w->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user