itom  4.1.0
MenuComboBox Class Reference

#include <menuComboBox.h>

Inheritance diagram for MenuComboBox:

Public Types

enum  EditableBehavior { NotEditable = 0, Editable, EditableOnFocus, EditableOnPopup }
 
typedef QWidget Superclass
 Superclass typedef.
 

Public Slots

void clearActiveAction ()
 
void setToolButtonStyle (Qt::ToolButtonStyle style)
 

Signals

void actionChanged (QAction *action)
 
void popupShown ()
 

Public Member Functions

 MenuComboBox (QWidget *parent=0)
 
Q_INVOKABLE void setMenu (QMenu *menu)
 
Q_INVOKABLE QMenu * menu () const
 
Q_INVOKABLE void setCompleterMenu (QMenu *menu)
 
Q_INVOKABLE QMenu * completerMenu () const
 
void setDefaultText (const QString &)
 
QString defaultText () const
 
void setDefaultIcon (const QIcon &)
 
QIcon defaultIcon () const
 
void setEditableBehavior (EditableBehavior editBehavior)
 
EditableBehavior editableBehavior () const
 
void setSearchIconVisible (bool state)
 
bool isSearchIconVisible () const
 
Qt::ToolButtonStyle toolButtonStyle () const
 
void setMinimumContentsLength (int characters)
 
QComboBox * menuComboBoxInternal () const
 Return the internal combo box.
 
QToolButton * toolButtonInternal () const
 Return the internal tool button.
 
CompletersearchCompleter () const
 Return the internal completer.
 

Protected Slots

void onActionSelected (QAction *action)
 
void onEditingFinished ()
 action selected from the line edit or the completer.
 

Protected Member Functions

virtual bool eventFilter (QObject *target, QEvent *event)
 

Protected Attributes

QScopedPointer< MenuComboBoxPrivated_ptr
 

Properties

QString defaultText
 
QIcon defaultIcon
 
EditableBehavior editBehavior
 
bool searchIconVisible
 
Qt::ToolButtonStyle toolButtonStyle
 

Private Member Functions

 Q_DECLARE_PRIVATE (MenuComboBox)
 
 Q_DISABLE_COPY (MenuComboBox)
 

Detailed Description

QComboBox linked with a QMenu. See MenuComboBox::setMenu() MenuComboBox can be editable, disable, editable on focus or editable on double click. if it is editable : the comboBox is always editable, you can filter the Menu or show it. if it is editable on focus - on double click: the combobox become editable when it has the focus in. So MenuComboBox's purpose is to filter a menu, if you edit the current text or show the menu, if you click on the arrow. if it is disabled : the MenuComboBox has the same behavior as a QPushButton. You can't filter the menu. By default MenuComboBox is not editable with the search icon visible. See MenuComboBox::setEditableType() to change the default behavior. and setIconSearchVisible() to show/hide the icon.

Member Function Documentation

void MenuComboBox::onActionSelected ( QAction *  action)
protectedslot

Change the current text/icon on the QComboBox And trigger the action. action selected from the menu.

Set the action selected in the combobox.

void MenuComboBox::setCompleterMenu ( QMenu *  menu)

Set a specific menu to the Completer.

This is useful when the menu displayed with the combobox is only a subset of the action that can be searched for.

See also
setMenu(), searchCompleter()
void MenuComboBox::setMenu ( QMenu *  menu)

Set menu to both the QComboBox and the associated Completer.

See also
setCompleterMenu(), searchCompleter()
void MenuComboBox::setMinimumContentsLength ( int  characters)

Set the minimum width of the combobox.

See also
QComboBox::setMinimumContentsLength()

Property Documentation

QIcon MenuComboBox::defaultIcon
readwrite

This property holds the icon shown on the combobox when the current item (QAction) doesn't have any icon associated. Empty by default

QString MenuComboBox::defaultText
readwrite

This property holds the text shown on the combobox when there is no selected item. Empty by default.

EditableBehavior MenuComboBox::editBehavior
readwrite

This property holds the edit behavior of the combobox, it defines what action is needed to turn the combobox into a search mode where the user can type the name of the item to select using the combobox line edit. MenuComboBox::NotEditable by default

See also
EditableType
bool MenuComboBox::searchIconVisible
readwrite

This property controls whether the search tool button is visible or hidden. True by default

Qt::ToolButtonStyle MenuComboBox::toolButtonStyle
readwrite

This property holds whether the search tool button displays an icon only, text only, or text beside/below the icon. The default is Qt::ToolButtonIconOnly.

See also
QToolButton::toolButtonStyle

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