I am using PyQt5. I want to know how to make my QComboBox open with ±10 items instead of the full screen. This only happens with the fusion style applied. Is there any way I can make this behave with a small drop down instead? I have tried to use setMaxVisibleItems(5), but it didn't make a difference.
Here is what it is looking like now:

As pointed out in QTBUG-89037, there's an undocumented stylesheet property that can be used to change the behaviour of the popup:
A value of
0will show the normal scrollable list-view with a maximum number of visible items, whilst a value of1shows the humungous menu.However, in some circumstances, setting a stylesheet may have undesirable side-effects, since it could potentially interfere with the default behaviour of QStyle. So an alternative solution might be to use a proxy-style, and reimplement its styleHint method so that it returns either
0or1for QStyle.SH_ComboBox_Popup.Both of these solutions work with both Qt5 and Qt6, and will also work for styles such as "cleanlooks" as well as "fusion".
Here's a simple demo that implements both solutions: