diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2024-01-10 20:37:19 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2024-01-12 12:59:26 +0100 |
commit | 742be5254c9919e8c743b8b489c054d778ee4850 (patch) | |
tree | 737f7c15322ffbf6fe690fa5ff2581f64e7d7bdb | |
parent | b4246a5c28472de3c4b6a85a3daf4a1d578894ab (diff) |
QComboBox: ignore hidden items when calculating popup size
The popup size depends on the max visible items property. But the loop
did not ignore the hidden items which results in fewer items in the
popup than allowed.
Fixes: QTBUG-120574
Pick-to: 6.7 6.6 6.5
Change-Id: Ic3c503a5272d6839aee158740e096405ca8887d6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 698b6341a9..76904aaadd 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2646,6 +2646,7 @@ void QComboBox::showPopup() QPoint above = mapToGlobal(listRect.topLeft()); int aboveHeight = above.y() - screen.y(); bool boundToScreen = !window()->testAttribute(Qt::WA_DontShowOnScreen); + const auto listView = qobject_cast<QListView *>(d->viewContainer()->itemView()); { int listHeight = 0; @@ -2660,6 +2661,8 @@ void QComboBox::showPopup() while (!toCheck.isEmpty()) { QModelIndex parent = toCheck.pop(); for (int i = 0, end = d->model->rowCount(parent); i < end; ++i) { + if (listView && listView->isRowHidden(i)) + continue; QModelIndex idx = d->model->index(i, d->modelColumn, parent); if (!idx.isValid()) continue; |