QComboBox: don't call index(-1, 0) on the underlying model

This is invalid and might assert in the model (e.g. in
QConcatenateTablesProxyModel)

Pick-to: 6.5 6.2
Change-Id: I6602d8b9eca83ef6cae760944a999d55244bb181
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
David Faure 2023-04-18 14:53:23 +02:00
parent 25530c7020
commit b06ae63e8f
1 changed files with 1 additions and 1 deletions

View File

@ -2098,7 +2098,7 @@ int QComboBox::currentIndex() const
void QComboBox::setCurrentIndex(int index)
{
Q_D(QComboBox);
QModelIndex mi = d->model->index(index, d->modelColumn, d->root);
QModelIndex mi = index >= 0 ? d->model->index(index, d->modelColumn, d->root) : QModelIndex();
d->setCurrentIndex(mi);
}