Public Member Functions | List of all members
pqAdjustToCurrentComboBox Class Reference

pqAdjustToCurrentComboBox is a QComboBox specialization whose size hint is based on the width needed to display the currently selected item, rather than the widest item in the model. More...

#include <pqAdjustToCurrentComboBox.h>

Inherits QComboBox.

Public Member Functions

 pqAdjustToCurrentComboBox (QWidget *parent=nullptr)
 
 ~pqAdjustToCurrentComboBox () override=default
 
QSize sizeHint () const override
 
QSize minimumSizeHint () const override
 

Detailed Description

pqAdjustToCurrentComboBox is a QComboBox specialization whose size hint is based on the width needed to display the currently selected item, rather than the widest item in the model.

QComboBox::AdjustToContents (and AdjustToContentsOnFirstShow) size the combobox to fit the widest entry in the list, so the widget never shrinks back down once a long item has been added, even if a short item is currently selected. pqAdjustToCurrentComboBox instead recomputes its size hint from the current item alone, so the combobox grows and shrinks as the selection changes.

Definition at line 22 of file pqAdjustToCurrentComboBox.h.

Constructor & Destructor Documentation

◆ pqAdjustToCurrentComboBox()

pqAdjustToCurrentComboBox::pqAdjustToCurrentComboBox ( QWidget *  parent = nullptr)

◆ ~pqAdjustToCurrentComboBox()

pqAdjustToCurrentComboBox::~pqAdjustToCurrentComboBox ( )
overridedefault

Member Function Documentation

◆ sizeHint()

QSize pqAdjustToCurrentComboBox::sizeHint ( ) const
override

◆ minimumSizeHint()

QSize pqAdjustToCurrentComboBox::minimumSizeHint ( ) const
override

The documentation for this class was generated from the following file: