ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
BoundedListView Class Reference

A QListView that caps the combo box popup height and repositions it. More...

#include <WidgetUtils.hpp>

Inherits QListView.

Collaboration diagram for BoundedListView:
Collaboration graph

Public Member Functions

 BoundedListView (QComboBox *combo)
 
QSize sizeHint () const override
 

Static Public Attributes

static constexpr int max_popup_height = 250
 

Protected Member Functions

void showEvent (QShowEvent *event) override
 

Detailed Description

A QListView that caps the combo box popup height and repositions it.

On Linux, Qt can compute the popup size from sizeHintForRow() * itemCount, ignoring setMaxVisibleItems(), and position the popup above the combo when it would overflow the screen. A deferred showEvent() resize then corrects both the height and the vertical position relative to the combo box.

sizeHint() is also overridden as a first-pass hint for platforms that do query it before positioning.