diff options
author | David Faure <david.faure@kdab.com> | 2023-04-18 14:53:23 +0200 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2023-04-19 14:11:35 +0000 |
commit | b06ae63e8f509d7ea451f9b530f2cbee21e7abdd (patch) | |
tree | 4349859c12b98a29d9d836186e1d9d46a246ac53 /src/widgets/widgets | |
parent | 25530c7020df099ed26737ee591bf6c55b3d8a39 (diff) |
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>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index b28bd154c3..fabd4e9eed 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -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); } |