Qtopia Home - Classes - Hierachy - Annotated - Functions - Qt Embedded |

# ContextMenu Class Reference

The ContextMenu class provides a QPopupMenu that is bound to a context button. More...

`#include <qtopia/contextmenu.h>`

List of all member functions.

## Public Members

- enum EditingState { Modal = 1, NonModal = 2 }
- ContextMenu ( QWidget * parent = 0, const char * name = 0, int state = 0 )
- ~ContextMenu ()
- void setEnableHelp ( bool b )
- void addTo ( QWidget * w, int state = 0 )
- void removeFrom ( QWidget * w, int state = 0 )
- void insertAction ( QAction * a, int idx = -1 )
- void addAction ( QAction * a )
- void popup ()
- void popup ( const QPoint & pos )
- virtual bool helpExists () const

## Public Slots

- virtual void help ()

## Static Public Members

- int key ()
- ContextMenu * menuFor ( QWidget * w, int state = 0 )

## Detailed Description

The ContextMenu class provides a QPopupMenu that is bound to a context button.

The Context Bar will be updated when the ContextMenu is available. Pressing the context button will popup the ContextMenu.

Note that the rules for context button assignment are identical as those for ContextBar, i.e. if the current focus widget does not claim the context key or have a context menu, then the context menu or label of an ancestor will be active.

ContextMenu is only available in the Qtopia Phone Edition.

See also ContextBar and Qtopia Phone Classes.

## Member Function Documentation

### ContextMenu::ContextMenu ( QWidget * parent = 0, const char * name = 0, int state = 0 )

Constructs a ContextMenu which will popup when Key_Menu is pressed and widget parent has focus and is in modal editing state state. The parent and name parameters are the standard Qt parent parameters.

See also ContextBar.

### ContextMenu::~ContextMenu ()

Destructs the ContextMenu

### void ContextMenu::addAction ( QAction * a )

Adds action a to the end of the menu.

See also insertAction().

### void ContextMenu::addTo ( QWidget * w, int state = 0 )

Adds this ContextMenu to widget w for modal editing state state.

See also removeFrom().

### void ContextMenu::help ()`[virtual slot]`

Invokes end-user help for the parent widget.

This slot is automatically connected to a 'Help' item if helpExists().

### bool ContextMenu::helpExists () const`[virtual]`

Returns whether help exists for the parent widget.

### void ContextMenu::insertAction ( QAction * a, int idx = -1 )

Inserts action a at position idx in the menu.

See also addAction().

### int ContextMenu::key ()`[static]`

Returns the context menu key.

### ContextMenu * ContextMenu::menuFor ( QWidget * w, int state = 0 )`[static]`

Returns the ContextMenu assigned to widget w in modal editing state state. If a ContextMenu does not yet exist for the widget, an empty menu will be created.

### void ContextMenu::popup ()

Opens the popup menu in a standard position.

### void ContextMenu::popup ( const QPoint & pos )

Opens the popup menu at pos.

### void ContextMenu::removeFrom ( QWidget * w, int state = 0 )

Removes this ContextMenu from widget w for modal editing state state.

See also addTo().

### void ContextMenu::setEnableHelp ( bool b )

Sets whether help is enabled in the context menu.

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