MenuButton Class Reference
The MenuButton class is a pushbutton with a menu. More...
#include <menubutton.h>
Inheritance diagram for MenuButton:


Public Slots | |
| void | select (int) |
| void | select (const QString &) |
Signals | |
| void | selected (int) |
| void | selected (const QString &) |
Public Member Functions | |
| MenuButton (QWidget *parent, const char *name=0) | |
| MenuButton (const QStringList &items, QWidget *parent, const char *name=0) | |
| void | clear () |
| int | currentItem () const |
| QString | currentText () const |
| void | insertItems (const QStringList &items) |
| void | insertItem (const QIconSet &icon, const QString &text=QString::null) |
| void | insertItem (const QString &text) |
| void | insertSeparator () |
| void | setLabel (const QString &label) |
| int | count () |
| void | remove (int id) |
| QString | text (int id) |
| void | setUseLabel (bool b) |
Detailed Description
The MenuButton class is a pushbutton with a menu.When the user presses the menubutton's pushbutton, the menu pops up. A menu is composed of menu items each of which has a string label, and optionally an icon.
The index of the item that the user's input device (e.g. stylus) is pointing at is the currentItem(), whose text is available using currentText().
Menu items are inserted with the constructor, insertItem() or insertItems(). Separators are inserted with insertSeparator(). All the items in the menu can be removed by calling clear().
Items can be selected programmatically using select(). When a menu item is selected (programmatically or by the user), the selected() signal is emitted.
Definition at line 26 of file menubutton.h.
Constructor & Destructor Documentation
|
||||||||||||
|
Constructs an empty MenuButton. The standard parent an name arguments are passed to the base class.
Definition at line 81 of file menubutton.cpp. |
|
||||||||||||||||
|
Constructs a MenuButton. A menu item is created (see insertItem() and insertItems()) for each string in the items string list. The standard parent an name arguments are passed to the base class. Definition at line 67 of file menubutton.cpp. References insertItems(). |
Member Function Documentation
|
|
Removes all the menu items from the button and menu. Definition at line 100 of file menubutton.cpp. |
|
|
Returns the index position of the current item. Definition at line 186 of file menubutton.cpp. |
|
|
Returns the label text of the current item. Definition at line 194 of file menubutton.cpp. References QPopupMenu::text(). Referenced by select(). |
|
|
A menu item is created (see insertItem()) for each string in the items string list. If any string is "--" a separator (see insertSeparator()) is inserted in its place. Definition at line 111 of file menubutton.cpp. References QValueList::begin(), QValueList::end(), insertItem(), and insertSeparator(). Referenced by MenuButton(). |
|
||||||||||||
|
Inserts a menu item with the icon icon and label text into the menu.
Definition at line 128 of file menubutton.cpp. References QPopupMenu::insertItem(). Referenced by insertItems(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Inserts a menu item with the label text into the menu.
Definition at line 140 of file menubutton.cpp. References QPopupMenu::insertItem(). |
|
|
Inserts a separator into the menu.
Definition at line 151 of file menubutton.cpp. References QPopupMenu::insertSeparator(). Referenced by insertItems(). |
|
|
Sets the menubutton's label. If label is empty, the current item text is displayed, otherwise label should contain "%1", which will be replaced by the current item text. Definition at line 204 of file menubutton.cpp. |
|
|
return count of items in menu Definition at line 234 of file menubutton.cpp. |
|
|
remove item at id Definition at line 225 of file menubutton.cpp. References QPopupMenu::removeItem(). |
|
|
returns text of item id Definition at line 242 of file menubutton.cpp. References QPopupMenu::text(). |
|
|
sets true or false the use of label Definition at line 250 of file menubutton.cpp. |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This signal is emitted when the item at position index is selected. Referenced by select(). |
|
|
This signal is emitted when the item with the label text is selected. |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Selects the item at index position s. Definition at line 173 of file menubutton.cpp. References currentText(), QPopupMenu::iconSet(), selected(), and QPushButton::setIconSet(). Referenced by select(). |
|
|
Selects the items with label text s. Definition at line 159 of file menubutton.cpp. References select(), and QPopupMenu::text(). |
The documentation for this class was generated from the following files:
