itom  4.1.0
ComboBox Class Reference

ComboBox is an advanced QComboBox. It adds multiple features: More...

#include <comboBox.h>

Inheritance diagram for ComboBox:

Public Types

enum  ScrollEffect { NeverScroll, AlwaysScroll, ScrollWithFocus, ScrollWithNoVScrollBar }
 turn into flags ? More...
 

Public Slots

void setCurrentUserDataAsString (QString userData)
 Set current item based on user data.
 

Public Member Functions

 ComboBox (QWidget *parent=0)
 Constructor, build a ComboBox that behaves like QComboBox.
 
void setDefaultText (const QString &)
 Empty by default (same behavior as QComboBox)
 
QString defaultText () const
 
void setDefaultIcon (const QIcon &)
 Empty by default (same behavior as QComboBox)
 
QIcon defaultIcon () const
 
void forceDefault (bool forceDefault)
 
bool isDefaultForced () const
 
void setElideMode (const Qt::TextElideMode &newMode)
 
Qt::TextElideMode elideMode () const
 
 Q_ENUM (ScrollEffect)
 
ScrollEffect scrollWheelEffect () const
 
void setScrollWheelEffect (ScrollEffect scroll)
 
virtual QSize minimumSizeHint () const
 Reimplemented for internal reasons.
 
virtual QSize sizeHint () const
 Reimplemented for internal reasons. More...
 
QString currentUserDataAsString () const
 Get current item's user data as string.
 

Protected Member Functions

virtual void paintEvent (QPaintEvent *event)
 Reimplemented for internal reasons.
 
virtual void changeEvent (QEvent *event)
 
virtual void wheelEvent (QWheelEvent *event)
 

Protected Attributes

QScopedPointer< ComboBoxPrivated_ptr
 

Properties

QString defaultText
 
QIcon defaultIcon
 
bool forceDefault
 
Qt::TextElideMode elideMode
 
ScrollEffect scrollWheelEffect
 
QString currentUserDataAsString
 Current item's user data as string (Qt::UserRole role)
 

Private Member Functions

 Q_DECLARE_PRIVATE (ComboBox)
 
 Q_DISABLE_COPY (ComboBox)
 

Detailed Description

ComboBox is an advanced QComboBox. It adds multiple features:

  • Display a default text and/or icon when the combobox current index is invalid (-1). A typical default text would be "Select a XXX...". forceDefault can force the display of the default text at all time (with a valid current index). The text displayed in the combo box can be elided when the size is too small.
  • Optionally prevent the mouse scroll events from changing the current index. ComboBox works exactly the same as QComboBox by default.
    See also
    QComboBox

Member Enumeration Documentation

turn into flags ?

Enumerator
NeverScroll 

Scrolling is not possible with the mouse wheel.

AlwaysScroll 

Scrolling is always possible with the mouse wheel.

ScrollWithFocus 

Scrolling is only possible if the combobox has the focus. The focus policy is automatically set to Qt::StrongFocus

ScrollWithNoVScrollBar 

Scrolling is not possible when the combobox is inside a scroll area with a visible vertical scrollbar.

Member Function Documentation

void ComboBox::forceDefault ( bool  forceDefault)

Force the display of the text/icon at all time (not only when the current index is invalid). False by default.

ScrollEffect ComboBox::scrollWheelEffect ( ) const

Return the scrollWheelEffect property value.

See also
scrollEffect
void ComboBox::setElideMode ( const Qt::TextElideMode &  newMode)

setElideMode can elide the text displayed on the combobox. Qt::ElideNone by default (same behavior as QComboBox)

void ComboBox::setScrollWheelEffect ( ComboBox::ScrollEffect  scroll)

Set the scrollWheelEffect property value.

See also
scrollEffect
QSize ComboBox::sizeHint ( ) const
virtual

Reimplemented for internal reasons.

This implementation caches the size hint to avoid resizing when the contents change dynamically. To invalidate the cached value change the sizeAdjustPolicy.

Property Documentation

ComboBox::ScrollEffect ComboBox::scrollWheelEffect
readwrite

This property controls the behavior of the mouse scroll wheel. ScrollOn by default. /sa scrollWheelEffect, setScrollWheelEffect


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