The QMenuData class is a base class for QMenuBar and QPopupMenu. (details) (complete member list)
#include <qmenudta.h>
Inherited by QMenuBar and QPopupMenu.
QMenuData has an internal list of menu items. A menu item is a string or a pixmap in a menu. The menu item sends out an activated() signal when it is selected, and a highlighted() signal when it receives the user input focus.
Menu items can be accessed through identifiers.
Constructs an empty list.
Removes all menu items and disconnects any signals that have been connected.
Returns the accelerator key that has been defined for the menu item id, or 0 if there is no accelerator key.
Changes the string of the menu item id.
Changes the pixmap of the menu item id.
Removes all menu items.
Connects a menu item to a receiver and a slot or signal.
The receiver will be notified when the menu item is activated.
Returns the number of items in the menu.
Disconnects a receiver/member from a menu item.
All connections are removed when the menu data object is destroyed.
Returns a pointer to the menu item.
Returns the identifier of the menu item at position index in the internal list.
Returns the index of the menu item.
Inserts a menu item with a string and optional accelerator key, and connects it to an object/slot. Returns the menu item identifier.
Example of use:
QPopupMenu *fileMenu = new QPopupMenu;
fileMenu->insert( "New", myView, SLOT(newFile()), CTRL+Key_N );
fileMenu->insert( "Open", myView, SLOT(open()), CTRL+Key_O );
See also: setAccel() and connectItem().
Inserts a menu item with a string. Returns the menu item identifier.
The menu item gets the identifier id if id >= 0 or a unique, negative identifier if id == -1 (default). The id must not be less than -1.
The index specifies the position in the menu. The menu item is appended at the end of the list if index is negative.
Inserts a menu item with a string and a sub menu. Returns the menu item identifier.
The menu item gets the identifier id if id >= 0 or a unique, negative identifier if id == -1 (default). The id must not be less than -1.
The index specifies the position in the menu. The menu item is appended at the end of the list if index is negative.
Inserts a menu item with a pixmap. Returns the menu item identifier.
The menu item gets the identifier id if id >= 0 or a unique, negative identifier if id == -1 (default). The id must not be less than -1.
The index specifies the position in the menu. The menu item is appended at the end of the list if index is negative.
Inserts a menu item with a pixmap and a sub menu. Returns the menu item identifier.
The menu item gets the identifier id if id >= 0 or a unique, negative identifier if id == -1 (default). The id must not be less than -1.
The index specifies the position in the menu. The menu item is appended at the end of the list if index is negative.
Inserts a separator at position index. The separator will become the last menu item if index is negative.
Returns TRUE if the menu item has been checked.
Returns TRUE if the item is disabled.
Virtual function; notifies subclasses that one or more items have been inserted or removed.
Virtual function; notifies subclasses that a popup menu item has been removed.
Virtual function; notifies subclasses that a popup menu item has been inserted.
Virtual function; notifies subclasses that one or more items have changed state (enabled/disabled or checked/unchecked).
Returns the pixmap that has been set for menu item id, or 0 if no pixmap has been set.
Removes the menu item which has the identifier id.
Removes the menu item at position index.
Defines an accelerator key for the menu item id.
An accelerator key consists of a key code and a combination of the modifiers
SHIFT,
CTRL
and ALT
(OR'ed or added).
The header file qkeycode.h has a list of key codes.
Defining an accelerator key generates a string which is added to the menu item,
for instance, CTRL
+ Key_O
generates "Ctrl+O". The string is formatted
differently for different platforms.
Notice that accelerators are only meaningful for popup submenus of a menu bar.
Example of use:
QPopupMenu *fm = new QPopupMenu; // file sub menu
fm->insertItem( "Open Document", 67 ); // add "Open" item
fm->setAccel( CTRL + Key_O, 67 );
fm->insertItem( "Quit", 69 ); // add "Quit" item
fm->setAccel( CTRL + ALT + Key_Delete, 69 );
Sets the menu identifier of the item at index to id.
If index is out of range the operation is ignored.
Checks a menu item if check is TRUE, or unchecks it if check is FALSE.
Enables the menu item if enable is TRUE, or disables the item if enable is FALSE.
Returns the string that has been set for menu item id, or 0 if no string has been set.
Virtual function; notifies subclasses about an item that has been changed.
This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.
It was generated from the following files: