diff options
-rw-r--r-- | src/gui/widgets/qcombobox.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qcombobox/tst_qcombobox.cpp | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 1504066..6cf24a6 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -1293,7 +1293,7 @@ QComboBox::~QComboBox() By default, this property has a value of 10. \note This property is ignored for non-editable comboboxes in styles that returns - false for QStyle::SH_ComboBox_Popup such as the Mac style or the Gtk+ Style. + true for QStyle::SH_ComboBox_Popup such as the Mac style or the Gtk+ Style. */ int QComboBox::maxVisibleItems() const { diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 1fcea9e..aa821c2 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2553,9 +2553,11 @@ void tst_QComboBox::maxVisibleItems() QAbstractItemView *v = comboBox.view(); int itemHeight = v->visualRect(v->model()->index(0,0)).height(); - if (v->style()->styleHint(QStyle::SH_ComboBox_Popup)) + QListView *lv = qobject_cast<QListView*>(v); + if (lv) + itemHeight += lv->spacing(); + if (!v->style()->styleHint(QStyle::SH_ComboBox_Popup)) QCOMPARE(v->viewport()->height(), itemHeight * comboBox.maxVisibleItems()); - // QCombobox without a popup does not work, see QTBUG-760 } |