更新时间:2022-12-12 16:56:23
根据文档:
对于在 `QStyle::SH_ComboBox_Popup 如 Mac 风格或 Gtk+ 风格.
The property
maxVisibleItems
is ignored for non-editable comboboxes in styles that returns true for `QStyle::SH_ComboBox_Popup such as the Mac style or the Gtk+ Style.
并且您可以使用样式表覆盖 SH_ComboBox_Popup
样式提示:
And you can override that SH_ComboBox_Popup
style hint with a style sheet:
combo.setStyleSheet("QComboBox { combobox-popup: 0; }");