API Documentation
Loading...
Searching...
No Matches
QCustomComboBox Class Reference

A compact way to present a list of options to the user. More...

#include <QCustomCombobox.h>

Inheritance diagram for QCustomComboBox:
[legend]
Collaboration diagram for QCustomComboBox:
[legend]

Signals

void edited ()
 

Public Member Functions

template<class t_type >
void add (const t_type &value, const TranslatedString &display_value, bool refresh_widget=false)
 
void clearValue ()
 
QCustomValidatorcustomValidator ()
 
const QCustomValidatorcustomValidator () const
 
const Buffer< TranslatedString > & displayValues () const
 
bool event (QEvent *event) override
 
void focusInEvent (QFocusEvent *e) override
 
template<class t_type >
t_type getAs () const
 
template<class t_type >
t_type getAs (uint04 index) const
 
Angle< fltp08getUnitAngle () const
 
fltp08 getUnitValue () const
 
void hidePopup () override
 
bool isUsingCustom () const
 
void lockInCustomValue ()
 
QSize minimumSizeHint () const override
 
void paintEvent (QPaintEvent *) override
 
 QCustomComboBox (QWidget *parent=nullptr)
 
void refresh ()
 
template<class t_type >
void remove (const t_type &value, bool refresh_widget=false)
 
void resizeEvent (QResizeEvent *event) override
 
template<class t_enum >
std::enable_if< ObjectInfo< t_enum >::Enum >::type set (t_enum value)
 
void setAllowCustom (bool allow_custom)
 
void setAutoFormat (bool auto_format)
 
void setConstantUnit (const ConstPointer< Unit > &unit, uint01 dimension=Constant< uint01 >::Invalid)
 
void setCustomUnit (const String &unit, UnitCategory fallback_unit, uint01 dimension=Constant< uint01 >::Invalid)
 
void setCustomValidator (const QCustomValidator &validator)
 
void setSuffix (const TranslatedString &suffix)
 
void setTitle (const TranslatedString &title)
 
void setToolTip (const TranslatedString &tooltip)
 
void setUnitType (UnitCategory unit, uint01 dimension=Constant< uint01 >::Invalid)
 
void setUnitValue (fltp08 value, uint01 unit_dimension=0)
 
template<class t_object >
void setup (const TranslatedString &title, const Buffer< std::pair< TranslatedString, t_object > > &items)
 
void setup (const TranslatedString &title, const Buffer< String > &values, const Buffer< TranslatedString > &display_values)
 
template<class t_object >
std::enable_if< ObjectInfo< t_object >::Enum >::type setup (const TranslatedString &title, const Buffer< t_object > &items)
 
template<class t_object >
std::enable_if< ObjectInfo< t_object >::Number >::type setup (const TranslatedString &title, const Buffer< t_object > &items)
 
template<class t_object >
std::enable_if<!ObjectInfo< t_object >::Enum &&!ObjectInfo< t_object >::Number >::type setup (const TranslatedString &title, const Buffer< t_object > &items)
 
void setup (const TranslatedString &title, const Buffer< TranslatedString > &values)
 
template<class t_enum >
std::enable_if< ObjectInfo< t_enum >::Enum >::type setup (const TranslatedString &title, t_enum first, t_enum last)
 
template<class t_enum >
std::enable_if< ObjectInfo< t_enum >::Enum >::type setup (const TranslatedString &title, uint04 size)
 
template<class t_type >
void setupResource (const TranslatedString &title, Resource< t_type > &resource)
 
void setValue (const String &value)
 
template<class t_type >
void setValue (const t_type &t_value)
 
void setValue (const TranslatedString &t_value)
 
void showPopup () override
 
QSize sizeHint () const override
 
void sortAlphabetically (uint04 start=0, uint04 size=Constant< uint04 >::Invalid)
 
const TranslatedStringsuffix () const
 
void updateFontSize ()
 
const Buffer< String > & values () const
 
void wheelEvent (QWheelEvent *e) override
 

Protected Slots

void onChange ()
 
void onEdit ()
 
void onEditTextChangedSlot ()
 

Protected Member Functions

void adjustLineEditSize ()
 
virtual void onSorted (const Buffer< uint04 > &swap_indices)
 
void refreshWidget ()
 

Protected Attributes

Dictionary< uint04, uint04enum_to_index
 
Dictionary< uint04, uint04index_to_enum
 
bool m_allow_custom
 
bool m_auto_format
 
String m_current_custom
 
uint04 m_custom_index
 
Buffer< TranslatedStringm_display_values
 
bool m_is_changing = false
 
bool m_is_refreshing = false
 
bool m_is_showing_popup = false
 
uint04 m_last_index
 
QCustomLineEditm_line_edit
 
QTResourceListenerm_resource_changed_listener
 
bool m_sort_alphabetically = false
 
uint04 m_sort_offset = 0
 
TranslatedString m_suffix
 
bool m_using_custom
 
Buffer< Stringm_values
 

Detailed Description

A compact way to present a list of options to the user.


A combobox is a selection widget that shows the current item, and pops up a list of selectable

items when clicked. Comboboxes can contain lists of translated data alongside of their program-values.

Constructor & Destructor Documentation

◆ QCustomComboBox()

QCustomComboBox ( QWidget * parent = nullptr)

Member Function Documentation

◆ add()

template<class t_type >
void add ( const t_type & value,
const TranslatedString & display_value,
bool refresh_widget = false )
inline

◆ adjustLineEditSize()

void adjustLineEditSize ( )
protected

◆ clearValue()

void clearValue ( )

◆ customValidator() [1/2]

QCustomValidator & customValidator ( )

◆ customValidator() [2/2]

const QCustomValidator & customValidator ( ) const

◆ displayValues()

const Buffer< TranslatedString > & displayValues ( ) const
inline

◆ edited

void edited ( )
signal

◆ event()

bool event ( QEvent * event)
override

◆ focusInEvent()

void focusInEvent ( QFocusEvent * e)
override

◆ getAs() [1/2]

template<class t_type >
t_type getAs ( ) const
inline

◆ getAs() [2/2]

template<class t_type >
t_type getAs ( uint04 index) const
inline

◆ getUnitAngle()

Angle< fltp08 > getUnitAngle ( ) const

◆ getUnitValue()

fltp08 getUnitValue ( ) const

◆ hidePopup()

void hidePopup ( )
override

◆ isUsingCustom()

bool isUsingCustom ( ) const
inline

◆ lockInCustomValue()

void lockInCustomValue ( )

◆ minimumSizeHint()

QSize minimumSizeHint ( ) const
override

◆ onChange

void onChange ( )
protectedslot

◆ onEdit

void onEdit ( )
protectedslot

◆ onEditTextChangedSlot

void onEditTextChangedSlot ( )
protectedslot

◆ onSorted()

virtual void onSorted ( const Buffer< uint04 > & swap_indices)
protectedvirtual

Reimplemented in ModelChooserCombo.

◆ paintEvent()

void paintEvent ( QPaintEvent * )
override

◆ refresh()

void refresh ( )
inline

◆ refreshWidget()

void refreshWidget ( )
protected

◆ remove()

template<class t_type >
void remove ( const t_type & value,
bool refresh_widget = false )
inline

◆ resizeEvent()

void resizeEvent ( QResizeEvent * event)
override

◆ set()

template<class t_enum >
std::enable_if< ObjectInfo< t_enum >::Enum >::type set ( t_enum value)
inline

◆ setAllowCustom()

void setAllowCustom ( bool allow_custom)
inline

◆ setAutoFormat()

void setAutoFormat ( bool auto_format)
inline

◆ setConstantUnit()

void setConstantUnit ( const ConstPointer< Unit > & unit,
uint01 dimension = Constantuint01 >::Invalid )

◆ setCustomUnit()

void setCustomUnit ( const String & unit,
UnitCategory fallback_unit,
uint01 dimension = Constantuint01 >::Invalid )

◆ setCustomValidator()

void setCustomValidator ( const QCustomValidator & validator)

◆ setSuffix()

void setSuffix ( const TranslatedString & suffix)
inline

◆ setTitle()

void setTitle ( const TranslatedString & title)

◆ setToolTip()

void setToolTip ( const TranslatedString & tooltip)

◆ setUnitType()

void setUnitType ( UnitCategory unit,
uint01 dimension = Constantuint01 >::Invalid )

◆ setUnitValue()

void setUnitValue ( fltp08 value,
uint01 unit_dimension = 0 )

◆ setup() [1/8]

template<class t_object >
void setup ( const TranslatedString & title,
const Buffer< std::pair< TranslatedString, t_object > > & items )
inline

◆ setup() [2/8]

void setup ( const TranslatedString & title,
const Buffer< String > & values,
const Buffer< TranslatedString > & display_values )

◆ setup() [3/8]

template<class t_object >
std::enable_if< ObjectInfo< t_object >::Enum >::type setup ( const TranslatedString & title,
const Buffer< t_object > & items )
inline

◆ setup() [4/8]

template<class t_object >
std::enable_if< ObjectInfo< t_object >::Number >::type setup ( const TranslatedString & title,
const Buffer< t_object > & items )
inline

◆ setup() [5/8]

template<class t_object >
std::enable_if<!ObjectInfo< t_object >::Enum &&!ObjectInfo< t_object >::Number >::type setup ( const TranslatedString & title,
const Buffer< t_object > & items )
inline

◆ setup() [6/8]

void setup ( const TranslatedString & title,
const Buffer< TranslatedString > & values )

◆ setup() [7/8]

template<class t_enum >
std::enable_if< ObjectInfo< t_enum >::Enum >::type setup ( const TranslatedString & title,
t_enum first,
t_enum last )
inline

◆ setup() [8/8]

template<class t_enum >
std::enable_if< ObjectInfo< t_enum >::Enum >::type setup ( const TranslatedString & title,
uint04 size )
inline

◆ setupResource()

template<class t_type >
void setupResource ( const TranslatedString & title,
Resource< t_type > & resource )
inline

◆ setValue() [1/3]

void setValue ( const String & value)

◆ setValue() [2/3]

template<class t_type >
void setValue ( const t_type & t_value)
inline

◆ setValue() [3/3]

void setValue ( const TranslatedString & t_value)
inline

◆ showPopup()

void showPopup ( )
override

◆ sizeHint()

QSize sizeHint ( ) const
override

◆ sortAlphabetically()

void sortAlphabetically ( uint04 start = 0,
uint04 size = Constantuint04 >::Invalid )

◆ suffix()

const TranslatedString & suffix ( ) const
inline

◆ updateFontSize()

void updateFontSize ( )

◆ values()

const Buffer< String > & values ( ) const
inline

◆ wheelEvent()

void wheelEvent ( QWheelEvent * e)
override

Member Data Documentation

◆ enum_to_index

Dictionary<uint04, uint04> enum_to_index
protected

◆ index_to_enum

Dictionary<uint04, uint04> index_to_enum
protected

◆ m_allow_custom

bool m_allow_custom
protected

◆ m_auto_format

bool m_auto_format
protected

◆ m_current_custom

String m_current_custom
protected

◆ m_custom_index

uint04 m_custom_index
protected

◆ m_display_values

Buffer<TranslatedString> m_display_values
protected

◆ m_is_changing

bool m_is_changing = false
protected

◆ m_is_refreshing

bool m_is_refreshing = false
protected

◆ m_is_showing_popup

bool m_is_showing_popup = false
protected

◆ m_last_index

uint04 m_last_index
protected

◆ m_line_edit

QCustomLineEdit* m_line_edit
protected

◆ m_resource_changed_listener

QTResourceListener* m_resource_changed_listener
protected

◆ m_sort_alphabetically

bool m_sort_alphabetically = false
protected

◆ m_sort_offset

uint04 m_sort_offset = 0
protected

◆ m_suffix

TranslatedString m_suffix
protected

◆ m_using_custom

bool m_using_custom
protected

◆ m_values

Buffer<String> m_values
protected

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