Qt API | Qtopia API Qtopia Documentation

MenuButton Class Reference

The MenuButton class is a pushbutton with a menu. More...

#include <qtopia/menubutton.h>

List of all member functions.

Public Members

Public Slots

Signals


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.

See also Qtopia Classes.


Member Function Documentation

MenuButton::MenuButton ( QWidget * parent, const char * name = 0 )

Constructs an empty MenuButton. The standard parent an name arguments are passed to the base class.

See also insertItem() and insertItems().

MenuButton::MenuButton ( const QStringList & items, QWidget * parent, const char * name = 0 )

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.

void MenuButton::clear ()

Removes all the menu items from the button and menu.

int MenuButton::currentItem () const

Returns the index position of the current item.

QString MenuButton::currentText () const

Returns the label text of the current item.

void MenuButton::insertItem ( const QIconSet & icon, const QString & text = QString::null )

Inserts a menu item with the icon icon and label text into the menu.

See also insertItems().

void MenuButton::insertItem ( const QString & text )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Inserts a menu item with the label text into the menu.

See also insertItems().

void MenuButton::insertItems ( const QStringList & items )

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.

void MenuButton::insertSeparator ()

Inserts a separator into the menu.

See also insertItems().

void MenuButton::select ( const QString & s ) [slot]

Selects the items with label text s.

void MenuButton::select ( int s ) [slot]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Selects the item at index position s.

void MenuButton::selected ( const QString & text ) [signal]

This signal is emitted when the item with the label text is selected.

void MenuButton::selected ( int index ) [signal]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This signal is emitted when the item at position index is selected.

void MenuButton::setLabel ( const QString & label )

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.

This file is part of the Qtopia , copyright © 1995-2002 Trolltech, all rights reserved.


Copyright © 2001-2002 TrolltechTrademarks
Qtopia version 1.7.1