Eneboo - Documentación para desarrolladores
Métodos públicos | Métodos protegidos | Atributos protegidos | Amigas
Referencia de la Clase QMenuData

The QMenuData class is a base class for QMenuBar and QPopupMenu. Más...

#include <qmenudata.h>

Diagrama de herencias de QMenuData
FriendlyMenuData QMenuBar QMenuBar QPopupMenu QPopupMenu MenuBarEditor MyMenuBar QtcMenuBar MenuBarEditor MyMenuBar QtcMenuBar MyPopupMenu QComboBoxPopup MyPopupMenu QComboBoxPopup

Lista de todos los miembros.

Métodos públicos

 QMenuData ()
virtual ~QMenuData ()
uint count () const
int insertItem (const QString &text, const QObject *receiver, const char *member, const QKeySequence &accel=0, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QString &text, const QObject *receiver, const char *member, const QKeySequence &accel=0, int id=-1, int index=-1)
int insertItem (const QPixmap &pixmap, const QObject *receiver, const char *member, const QKeySequence &accel=0, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QPixmap &pixmap, const QObject *receiver, const char *member, const QKeySequence &accel=0, int id=-1, int index=-1)
int insertItem (const QString &text, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QString &text, int id=-1, int index=-1)
int insertItem (const QString &text, QPopupMenu *popup, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QString &text, QPopupMenu *popup, int id=-1, int index=-1)
int insertItem (const QPixmap &pixmap, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QPixmap &pixmap, int id=-1, int index=-1)
int insertItem (const QPixmap &pixmap, QPopupMenu *popup, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QPixmap &pixmap, QPopupMenu *popup, int id=-1, int index=-1)
int insertItem (QWidget *widget, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, QCustomMenuItem *custom, int id=-1, int index=-1)
int insertItem (QCustomMenuItem *custom, int id=-1, int index=-1)
int insertSeparator (int index=-1)
void removeItem (int id)
void removeItemAt (int index)
void clear ()
QKeySequence accel (int id) const
void setAccel (const QKeySequence &key, int id)
QIconSeticonSet (int id) const
QString text (int id) const
QPixmappixmap (int id) const
void setWhatsThis (int id, const QString &)
QString whatsThis (int id) const
void changeItem (int id, const QString &text)
void changeItem (int id, const QPixmap &pixmap)
void changeItem (int id, const QIconSet &icon, const QString &text)
void changeItem (int id, const QIconSet &icon, const QPixmap &pixmap)
void changeItem (const QString &text, int id)
void changeItem (const QPixmap &pixmap, int id)
void changeItem (const QIconSet &icon, const QString &text, int id)
bool isItemActive (int id) const
bool isItemEnabled (int id) const
void setItemEnabled (int id, bool enable)
bool isItemChecked (int id) const
void setItemChecked (int id, bool check)
bool isItemVisible (int id) const
void setItemVisible (int id, bool visible)
virtual void updateItem (int id)
int indexOf (int id) const
int idAt (int index) const
virtual void setId (int index, int id)
bool connectItem (int id, const QObject *receiver, const char *member)
bool disconnectItem (int id, const QObject *receiver, const char *member)
bool setItemParameter (int id, int param)
int itemParameter (int id) const
QMenuItemfindItem (int id) const
QMenuItemfindItem (int id, QMenuData **parent) const
QMenuItemfindPopup (QPopupMenu *, int *index=0)
virtual void activateItemAt (int index)
 QMenuData ()
virtual ~QMenuData ()
uint count () const
int insertItem (const QString &text, const QObject *receiver, const char *member, const QKeySequence &accel=0, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QString &text, const QObject *receiver, const char *member, const QKeySequence &accel=0, int id=-1, int index=-1)
int insertItem (const QPixmap &pixmap, const QObject *receiver, const char *member, const QKeySequence &accel=0, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QPixmap &pixmap, const QObject *receiver, const char *member, const QKeySequence &accel=0, int id=-1, int index=-1)
int insertItem (const QString &text, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QString &text, int id=-1, int index=-1)
int insertItem (const QString &text, QPopupMenu *popup, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QString &text, QPopupMenu *popup, int id=-1, int index=-1)
int insertItem (const QPixmap &pixmap, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QPixmap &pixmap, int id=-1, int index=-1)
int insertItem (const QPixmap &pixmap, QPopupMenu *popup, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, const QPixmap &pixmap, QPopupMenu *popup, int id=-1, int index=-1)
int insertItem (QWidget *widget, int id=-1, int index=-1)
int insertItem (const QIconSet &icon, QCustomMenuItem *custom, int id=-1, int index=-1)
int insertItem (QCustomMenuItem *custom, int id=-1, int index=-1)
int insertSeparator (int index=-1)
void removeItem (int id)
void removeItemAt (int index)
void clear ()
QKeySequence accel (int id) const
void setAccel (const QKeySequence &key, int id)
QIconSeticonSet (int id) const
QString text (int id) const
QPixmappixmap (int id) const
void setWhatsThis (int id, const QString &)
QString whatsThis (int id) const
void changeItem (int id, const QString &text)
void changeItem (int id, const QPixmap &pixmap)
void changeItem (int id, const QIconSet &icon, const QString &text)
void changeItem (int id, const QIconSet &icon, const QPixmap &pixmap)
void changeItem (const QString &text, int id)
void changeItem (const QPixmap &pixmap, int id)
void changeItem (const QIconSet &icon, const QString &text, int id)
bool isItemActive (int id) const
bool isItemEnabled (int id) const
void setItemEnabled (int id, bool enable)
bool isItemChecked (int id) const
void setItemChecked (int id, bool check)
bool isItemVisible (int id) const
void setItemVisible (int id, bool visible)
virtual void updateItem (int id)
int indexOf (int id) const
int idAt (int index) const
virtual void setId (int index, int id)
bool connectItem (int id, const QObject *receiver, const char *member)
bool disconnectItem (int id, const QObject *receiver, const char *member)
bool setItemParameter (int id, int param)
int itemParameter (int id) const
QMenuItemfindItem (int id) const
QMenuItemfindItem (int id, QMenuData **parent) const
QMenuItemfindPopup (QPopupMenu *, int *index=0)
virtual void activateItemAt (int index)

Métodos protegidos

virtual void menuContentsChanged ()
virtual void menuStateChanged ()
virtual void menuInsPopup (QPopupMenu *)
virtual void menuDelPopup (QPopupMenu *)
virtual void menuContentsChanged ()
virtual void menuStateChanged ()
virtual void menuInsPopup (QPopupMenu *)
virtual void menuDelPopup (QPopupMenu *)

Atributos protegidos

int actItem
QMenuItemListmitems
QMenuDataparentMenu
uint isPopupMenu: 1
uint isMenuBar: 1
uint badSize: 1
uint mouseBtDn: 1
uint avoid_circularity: 1
uint actItemDown: 1

Amigas

class QMenuBar
class QPopupMenu

Descripción detallada

The QMenuData class is a base class for QMenuBar and QPopupMenu.

QMenuData has an internal list of menu items. A menu item can have a text(), an accelerator, a pixmap(), an iconSet(), a whatsThis() text and a popup menu (unless it is a separator). Menu items may optionally be checked (except for separators).

The menu item sends out an activated() signal when it is chosen and a highlighted() signal when it receives the user input focus.

menu identifier

Menu items are assigned the menu identifier id that is passed in insertItem() or an automatically generated identifier if id is < 0 (the default). The generated identifiers (negative integers) are guaranteed to be unique within the entire application. The identifier is used to access the menu item in other functions.

Menu items can be removed with removeItem() and removeItemAt(), or changed with changeItem(). All menu items can be removed with clear(). Accelerators can be changed or set with setAccel(). Checkable items can be checked or unchecked with setItemChecked(). Items can be enabled or disabled using setItemEnabled() and connected and disconnected with connectItem() and disconnectItem() respectively. By default, newly created menu items are visible. They can be hidden (and shown again) with setItemVisible().

Menu items are stored in a list. Use findItem() to find an item by its list position or by its menu identifier. (See also indexOf() and idAt().)

Ver también:
QAccel QPopupMenu QAction

Documentación del constructor y destructor

QMenuData::QMenuData ( )

Constructs an empty menu data list.

QMenuData::~QMenuData ( ) [virtual]

Removes all menu items and disconnects any signals that have been connected.

QMenuData::QMenuData ( )
virtual QMenuData::~QMenuData ( ) [virtual]

Documentación de las funciones miembro

QKeySequence QMenuData::accel ( int  id) const

Returns the accelerator key that has been defined for the menu item id, or 0 if it has no accelerator key or if there is no such menu item.

Ver también:
setAccel(), QAccel, qnamespace.h
QKeySequence QMenuData::accel ( int  id) const
void QMenuData::activateItemAt ( int  index) [virtual]

Activates the menu item at position index.

If the index is invalid (for example, -1), the object itself is deactivated.

Reimplementado en QMenuBar, QPopupMenu, QMenuBar y QPopupMenu.

virtual void QMenuData::activateItemAt ( int  index) [virtual]

Reimplementado en QMenuBar, QPopupMenu, QMenuBar y QPopupMenu.

void QMenuData::changeItem ( const QString text,
int  id 
) [inline]

Changes the text of the menu item id. If the item has an icon, the icon remains unchanged.

Ver también:
text()
void QMenuData::changeItem ( const QIconSet icon,
const QString text,
int  id 
) [inline]

Changes the icon and text of the menu item id.

Ver también:
pixmap()
void QMenuData::changeItem ( const QPixmap pixmap,
int  id 
) [inline]

Changes the pixmap of the menu item id. If the item has an icon, the icon remains unchanged.

Ver también:
pixmap()
void QMenuData::changeItem ( int  id,
const QString text 
)
void QMenuData::changeItem ( int  id,
const QPixmap pixmap 
)
void QMenuData::changeItem ( int  id,
const QIconSet icon,
const QString text 
)
void QMenuData::changeItem ( int  id,
const QIconSet icon,
const QPixmap pixmap 
)
void QMenuData::changeItem ( const QString text,
int  id 
) [inline]
void QMenuData::changeItem ( const QPixmap pixmap,
int  id 
) [inline]
void QMenuData::changeItem ( const QIconSet icon,
const QString text,
int  id 
) [inline]
void QMenuData::changeItem ( int  id,
const QString text 
)

Changes the text of the menu item id to text. If the item has an icon, the icon remains unchanged.

Ver también:
text()
void QMenuData::changeItem ( int  id,
const QPixmap pixmap 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Changes the pixmap of the menu item id to the pixmap pixmap. If the item has an icon, the icon is unchanged.

Ver también:
pixmap()
void QMenuData::changeItem ( int  id,
const QIconSet icon,
const QString text 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Changes the iconset and text of the menu item id to the icon and text respectively.

Ver también:
pixmap()
void QMenuData::changeItem ( int  id,
const QIconSet icon,
const QPixmap pixmap 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Changes the iconset and pixmap of the menu item id to icon and pixmap respectively.

Ver también:
pixmap()
void QMenuData::clear ( void  )

Removes all menu items.

Ver también:
removeItem(), removeItemAt()
void QMenuData::clear ( )
bool QMenuData::connectItem ( int  id,
const QObject receiver,
const char *  member 
)

Connects the menu item with identifier id to {receiver}'s member slot or signal.

The receiver's slot (or signal) is activated when the menu item is activated.

Ver también:
disconnectItem(), setItemParameter()
bool QMenuData::connectItem ( int  id,
const QObject receiver,
const char *  member 
)
uint QMenuData::count ( ) const

Returns the number of items in the menu.

uint QMenuData::count ( ) const
bool QMenuData::disconnectItem ( int  id,
const QObject receiver,
const char *  member 
)

Disconnects the {receiver}'s member from the menu item with identifier id.

All connections are removed when the menu data object is destroyed.

Ver también:
connectItem(), setItemParameter()
bool QMenuData::disconnectItem ( int  id,
const QObject receiver,
const char *  member 
)
QMenuItem * QMenuData::findItem ( int  id,
QMenuData **  parent 
) const

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the menu item with identifier id, or 0 if there is no item with this identifier. Changes *parent to point to the parent of the return value.

Note that QMenuItem is an internal class, and that you should not need to call this function. Use the higher level functions like text(), pixmap() and changeItem() to get and modify menu item attributes instead.

Ver también:
indexOf()
QMenuItem * QMenuData::findItem ( int  id) const

Returns the menu item with identifier id, or 0 if there is no item with this identifier.

Note that QMenuItem is an internal class, and that you should not need to call this function. Use the higher level functions like text(), pixmap() and changeItem() to get and modify menu item attributes instead.

Ver también:
indexOf()
QMenuItem* QMenuData::findItem ( int  id) const
QMenuItem* QMenuData::findItem ( int  id,
QMenuData **  parent 
) const
QMenuItem * QMenuData::findPopup ( QPopupMenu popup,
int index = 0 
)
QMenuItem* QMenuData::findPopup ( QPopupMenu ,
int index = 0 
)
QIconSet* QMenuData::iconSet ( int  id) const
QIconSet * QMenuData::iconSet ( int  id) const

Returns the icon set that has been set for menu item id, or 0 if no icon set has been set.

Ver también:
changeItem(), text(), pixmap()
int QMenuData::idAt ( int  index) const

Returns the identifier of the menu item at position index in the internal list, or -1 if index is out of range.

Ver también:
setId(), indexOf()

Reimplementado en QPopupMenu y QPopupMenu.

int QMenuData::idAt ( int  index) const

Reimplementado en QPopupMenu y QPopupMenu.

int QMenuData::indexOf ( int  id) const

Returns the index of the menu item with identifier id, or -1 if there is no item with this identifier.

Ver también:
idAt(), findItem()
int QMenuData::indexOf ( int  id) const
int QMenuData::insertItem ( const QPixmap pixmap,
const QObject receiver,
const char *  member,
const QKeySequence accel = 0,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with pixmap pixmap, accelerator accel, optional id id, and optional index position. The menu item is connected it to the receiver's member slot. The icon will be displayed to the left of the text in the item.

To look best when being highlighted as a menu item, the pixmap should provide a mask (see QPixmap::mask()).

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem()
int QMenuData::insertItem ( QCustomMenuItem custom,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a custom menu item custom with optional id id, and optional index position.

This only works with popup menus. It is not supported for menu bars. Ownership of custom is transferred to the popup menu.

If you want to connect a custom item to a slot, use connectItem().

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
connectItem(), removeItem(), QCustomMenuItem
int QMenuData::insertItem ( const QIconSet icon,
const QString text,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QString text,
QPopupMenu popup,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QString text,
QPopupMenu popup,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with text text, submenu popup, optional id id, and optional index position.

The popup must be deleted by the programmer or by its parent widget. It is not deleted when this menu item is removed or when the menu is deleted.

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem()
int QMenuData::insertItem ( const QIconSet icon,
const QString text,
QPopupMenu popup,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QPixmap pixmap,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QIconSet icon,
const QPixmap pixmap,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QPixmap pixmap,
QPopupMenu popup,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QIconSet icon,
const QPixmap pixmap,
QPopupMenu popup,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( QWidget widget,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QIconSet icon,
QCustomMenuItem custom,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( QCustomMenuItem custom,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QIconSet icon,
const QString text,
QPopupMenu popup,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with icon icon, text text, submenu popup, optional id id, and optional index position. The icon will be displayed to the left of the text in the item.

The popup must be deleted by the programmer or by its parent widget. It is not deleted when this menu item is removed or when the menu is deleted.

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem()
int QMenuData::insertItem ( const QString text,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QIconSet icon,
const QPixmap pixmap,
const QObject receiver,
const char *  member,
const QKeySequence accel = 0,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QPixmap pixmap,
const QObject receiver,
const char *  member,
const QKeySequence accel = 0,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QPixmap pixmap,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with pixmap pixmap, optional id id, and optional index position.

To look best when being highlighted as a menu item, the pixmap should provide a mask (see QPixmap::mask()).

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem()
int QMenuData::insertItem ( const QString text,
const QObject receiver,
const char *  member,
const QKeySequence accel = 0,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QString text,
const QObject receiver,
const char *  member,
const QKeySequence accel = 0,
int  id = -1,
int  index = -1 
)

The family of insertItem() functions inserts menu items into a popup menu or a menu bar.

A menu item is usually either a text string or a pixmap, both with an optional icon or keyboard accelerator. For special cases it is also possible to insert custom items (see {QCustomMenuItem}) or even widgets into popup menus.

Some insertItem() members take a popup menu as an additional argument. Use this to insert submenus into existing menus or pulldown menus into a menu bar.

The number of insert functions may look confusing, but they are actually quite simple to use.

This default version inserts a menu item with the text text, the accelerator key accel, an id and an optional index and connects it to the slot member in the object receiver.

Example:

        QMenuBar   *mainMenu = new QMenuBar;
        QPopupMenu *fileMenu = new QPopupMenu;
        fileMenu->insertItem( "New",  myView, SLOT(newFile()), CTRL+Key_N );
        fileMenu->insertItem( "Open", myView, SLOT(open()),    CTRL+Key_O );
        mainMenu->insertItem( "File", fileMenu );

Not all insert functions take an object/slot parameter or an accelerator key. Use connectItem() and setAccel() on those items.

If you need to translate accelerators, use tr() with the text and accelerator. (For translations use a string key sequence.):

        fileMenu->insertItem( tr("Open"), myView, SLOT(open()),
                              tr("Ctrl+O") );

In the example above, pressing Ctrl+O or selecting "Open" from the menu activates the myView->open() function.

Some insert functions take a QIconSet parameter to specify the little menu item icon. Note that you can always pass a QPixmap object instead.

The id specifies the identification number associated with the menu item. Note that only positive values are valid, as a negative value will make Qt select a unique id for the item.

The index specifies the position in the menu. The menu item is appended at the end of the list if index is negative.

Note that keyboard accelerators in Qt are not application-global, instead they are bound to a certain top-level window. For example, accelerators in QPopupMenu items only work for menus that are associated with a certain window. This is true for popup menus that live in a menu bar since their accelerators will then be installed in the menu bar itself. This also applies to stand-alone popup menus that have a top-level widget in their parentWidget() chain. The menu will then install its accelerator object on that top-level widget. For all other cases use an independent QAccel object.

Atención:
Be careful when passing a literal 0 to insertItem() because some C++ compilers choose the wrong overloaded function. Cast the 0 to what you mean, e.g. {(QObject*)0}.
On Mac OS X, items that connect to a slot that are inserted into a menubar will not function as we use the native menubar that knows nothing about signals or slots. Instead insert the items into a popup menu and insert the popup menu into the menubar. This may be fixed in a future Qt version.

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem(), QAccel, qnamespace.h
int QMenuData::insertItem ( const QIconSet icon,
const QPixmap pixmap,
const QObject receiver,
const char *  member,
const QKeySequence accel = 0,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with icon icon, pixmap pixmap, accelerator accel, optional id id, and optional index position. The icon will be displayed to the left of the pixmap in the item. The item is connected to the member slot in the receiver object.

To look best when being highlighted as a menu item, the pixmap should provide a mask (see QPixmap::mask()).

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem(), QAccel, qnamespace.h
int QMenuData::insertItem ( const QIconSet icon,
const QPixmap pixmap,
QPopupMenu popup,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with icon icon, pixmap pixmap submenu popup, optional id id, and optional index position. The icon will be displayed to the left of the pixmap in the item.

The popup must be deleted by the programmer or by its parent widget. It is not deleted when this menu item is removed or when the menu is deleted.

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem()
int QMenuData::insertItem ( const QIconSet icon,
const QPixmap pixmap,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with icon icon, pixmap pixmap, optional id id, and optional index position. The icon will be displayed to the left of the pixmap in the item.

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem()
int QMenuData::insertItem ( const QPixmap pixmap,
QPopupMenu popup,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with pixmap pixmap, submenu popup, optional id id, and optional index position.

The popup must be deleted by the programmer or by its parent widget. It is not deleted when this menu item is removed or when the menu is deleted.

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem()
int QMenuData::insertItem ( QWidget widget,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item that consists of the widget widget with optional id id, and optional index position.

Ownership of widget is transferred to the popup menu or to the menu bar.

Theoretically, any widget can be inserted into a popup menu. In practice, this only makes sense with certain widgets.

If a widget is not focus-enabled (see {QWidget::isFocusEnabled()}), the menu treats it as a separator; this means that the item is not selectable and will never get focus. In this way you can, for example, simply insert a QLabel if you need a popup menu with a title.

If the widget is focus-enabled it will get focus when the user traverses the popup menu with the arrow keys. If the widget does not accept ArrowUp and ArrowDown in its key event handler, the focus will move back to the menu when the respective arrow key is hit one more time. This works with a QLineEdit, for example. If the widget accepts the arrow key itself, it must also provide the possibility to put the focus back on the menu again by calling QWidget::focusNextPrevChild(). Futhermore, if the embedded widget closes the menu when the user made a selection, this can be done safely by calling:

        if ( isVisible() &&
             parentWidget() &&
             parentWidget()->inherits("QPopupMenu") )
            parentWidget()->close();

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem()
int QMenuData::insertItem ( const QIconSet icon,
const QString text,
const QObject receiver,
const char *  member,
const QKeySequence accel = 0,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with icon icon, text text, accelerator accel, optional id id, and optional index position. The menu item is connected it to the receiver's member slot. The icon will be displayed to the left of the text in the item.

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem(), QAccel, qnamespace.h
int QMenuData::insertItem ( const QIconSet icon,
const QString text,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with icon icon, text text, optional id id, and optional index position. The icon will be displayed to the left of the text in the item.

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem()
int QMenuData::insertItem ( const QIconSet icon,
QCustomMenuItem custom,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a custom menu item custom with an icon and with optional id id, and optional index position.

This only works with popup menus. It is not supported for menu bars. Ownership of custom is transferred to the popup menu.

If you want to connect a custom item to a slot, use connectItem().

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
connectItem(), removeItem(), QCustomMenuItem
int QMenuData::insertItem ( const QIconSet icon,
const QString text,
const QObject receiver,
const char *  member,
const QKeySequence accel = 0,
int  id = -1,
int  index = -1 
)
int QMenuData::insertItem ( const QString text,
int  id = -1,
int  index = -1 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts a menu item with text text, optional id id, and optional index position.

Returns the allocated menu identifier number (id if id >= 0).

Ver también:
removeItem(), changeItem(), setAccel(), connectItem()
int QMenuData::insertSeparator ( int  index = -1)

Inserts a separator at position index, and returns the menu identifier number allocated to it. The separator becomes the last menu item if index is negative.

In a popup menu a separator is rendered as a horizontal line. In a Motif menu bar a separator is spacing, so the rest of the items (normally just "Help") are drawn right-justified. In a Windows menu bar separators are ignored (to comply with the Windows style guidelines).

Reimplementado en MenuBarEditor.

int QMenuData::insertSeparator ( int  index = -1)

Reimplementado en MenuBarEditor.

bool QMenuData::isItemActive ( int  id) const

Returns TRUE if the menu item with the id id is currently active; otherwise returns FALSE.

bool QMenuData::isItemActive ( int  id) const
bool QMenuData::isItemChecked ( int  id) const

Returns TRUE if the menu item with the id id has been checked; otherwise returns FALSE.

Ver también:
setItemChecked()
bool QMenuData::isItemChecked ( int  id) const
bool QMenuData::isItemEnabled ( int  id) const

Returns TRUE if the item with identifier id is enabled; otherwise returns FALSE

Ver también:
setItemEnabled(), isItemVisible()
bool QMenuData::isItemEnabled ( int  id) const
bool QMenuData::isItemVisible ( int  id) const

Returns TRUE if the menu item with the id id is visible; otherwise returns FALSE.

Ver también:
setItemVisible()
bool QMenuData::isItemVisible ( int  id) const
int QMenuData::itemParameter ( int  id) const
int QMenuData::itemParameter ( int  id) const

Returns the parameter of the activation signal of item id.

If no parameter has been specified for this item with setItemParameter(), the value defaults to id.

Ver también:
connectItem(), disconnectItem(), setItemParameter()
void QMenuData::menuContentsChanged ( ) [protected, virtual]

Virtual function; notifies subclasses that one or more items have been inserted or removed.

Reimplementado en QMenuBar y QMenuBar.

virtual void QMenuData::menuContentsChanged ( ) [protected, virtual]

Reimplementado en QMenuBar y QMenuBar.

virtual void QMenuData::menuDelPopup ( QPopupMenu ) [protected, virtual]
void QMenuData::menuDelPopup ( QPopupMenu ) [protected, virtual]

Virtual function; notifies subclasses that a popup menu item has been removed.

virtual void QMenuData::menuInsPopup ( QPopupMenu ) [protected, virtual]
void QMenuData::menuInsPopup ( QPopupMenu ) [protected, virtual]

Virtual function; notifies subclasses that a popup menu item has been inserted.

void QMenuData::menuStateChanged ( ) [protected, virtual]

Virtual function; notifies subclasses that one or more items have changed state (enabled/disabled or checked/unchecked).

Reimplementado en QMenuBar y QMenuBar.

virtual void QMenuData::menuStateChanged ( ) [protected, virtual]

Reimplementado en QMenuBar y QMenuBar.

QPixmap * QMenuData::pixmap ( int  id) const

Returns the pixmap that has been set for menu item id, or 0 if no pixmap has been set.

Ver también:
changeItem(), text(), iconSet()
QPixmap* QMenuData::pixmap ( int  id) const
void QMenuData::removeItem ( int  id)
void QMenuData::removeItem ( int  id)

Removes the menu item that has the identifier id.

Ver también:
removeItemAt(), clear()
void QMenuData::removeItemAt ( int  index)

Removes the menu item at position index.

Ver también:
removeItem(), clear()

Reimplementado en MenuBarEditor.

void QMenuData::removeItemAt ( int  index)

Reimplementado en MenuBarEditor.

void QMenuData::setAccel ( const QKeySequence key,
int  id 
)
void QMenuData::setAccel ( const QKeySequence key,
int  id 
)

Sets the accelerator key for the menu item id to key.

An accelerator key consists of a key code and a combination of the modifiers SHIFT, CTRL, ALT or UNICODE_ACCEL (OR'ed or added). The header file qnamespace.h contains a list of key codes.

Defining an accelerator key produces a text that is added to the menu item; for instance, CTRL + Key_O produces "Ctrl+O". The text is formatted differently for different platforms.

Note that keyboard accelerators in Qt are not application-global, instead they are bound to a certain top-level window. For example, accelerators in QPopupMenu items only work for menus that are associated with a certain window. This is true for popup menus that live in a menu bar since their accelerators will then be installed in the menu bar itself. This also applies to stand-alone popup menus that have a top-level widget in their parentWidget() chain. The menu will then install its accelerator object on that top-level widget. For all other cases use an independent QAccel object.

Example:

        QMenuBar *mainMenu = new QMenuBar;
        QPopupMenu *fileMenu = new QPopupMenu;       // file sub menu
        fileMenu->insertItem( "Open Document", 67 ); // add "Open" item
        fileMenu->setAccel( CTRL + Key_O, 67 );      // Ctrl+O to open
        fileMenu->insertItem( "Quit", 69 );          // add "Quit" item
        fileMenu->setAccel( CTRL + ALT + Key_Delete, 69 ); // add Alt+Del to quit
        mainMenu->insertItem( "File", fileMenu );    // add the file menu

If you need to translate accelerators, use tr() with a string:

        fileMenu->setAccel( tr("Ctrl+O"), 67 );

You can also specify the accelerator in the insertItem() function. You may prefer to use QAction to associate accelerators with menu items.

Ver también:
accel() insertItem() QAccel QAction
virtual void QMenuData::setId ( int  index,
int  id 
) [virtual]
void QMenuData::setId ( int  index,
int  id 
) [virtual]

Sets the menu identifier of the item at index to id.

If index is out of range, the operation is ignored.

Ver también:
idAt()
void QMenuData::setItemChecked ( int  id,
bool  check 
)

If check is TRUE, checks the menu item with id id; otherwise unchecks the menu item with id id. Calls QPopupMenu::setCheckable( TRUE ) if necessary.

Ver también:
isItemChecked()
void QMenuData::setItemChecked ( int  id,
bool  check 
)
void QMenuData::setItemEnabled ( int  id,
bool  enable 
)

If enable is TRUE, enables the menu item with identifier id; otherwise disables the menu item with identifier id.

Ver también:
isItemEnabled()
void QMenuData::setItemEnabled ( int  id,
bool  enable 
)
bool QMenuData::setItemParameter ( int  id,
int  param 
)
bool QMenuData::setItemParameter ( int  id,
int  param 
)

Sets the parameter of the activation signal of item id to param.

If any receiver takes an integer parameter, this value is passed.

Ver también:
connectItem(), disconnectItem(), itemParameter()
void QMenuData::setItemVisible ( int  id,
bool  visible 
)

If visible is TRUE, shows the menu item with id id; otherwise hides the menu item with id id.

Ver también:
isItemVisible(), isItemEnabled()
void QMenuData::setItemVisible ( int  id,
bool  visible 
)
void QMenuData::setWhatsThis ( int  id,
const QString  
)
void QMenuData::setWhatsThis ( int  id,
const QString text 
)

Sets text as What's This help for the menu item with identifier id.

Ver también:
whatsThis()
QString QMenuData::text ( int  id) const

Returns the text that has been set for menu item id, or QString::null if no text has been set.

Ver también:
changeItem(), pixmap(), iconSet()
QString QMenuData::text ( int  id) const
void QMenuData::updateItem ( int  id) [virtual]

Virtual function; notifies subclasses about an item with id that has been changed.

Reimplementado en QMenuBar, QPopupMenu, QMenuBar y QPopupMenu.

virtual void QMenuData::updateItem ( int  id) [virtual]

Reimplementado en QMenuBar, QPopupMenu, QMenuBar y QPopupMenu.

QString QMenuData::whatsThis ( int  id) const
QString QMenuData::whatsThis ( int  id) const

Returns the What's This help text for the item with identifier id or QString::null if no text has yet been defined.

Ver también:
setWhatsThis()

Documentación de las funciones relacionadas y clases amigas

QMenuBar [friend]

Reimplementado en QPopupMenu.

QPopupMenu [friend]

Reimplementado en QMenuBar.


Documentación de los datos miembro

int QMenuData::actItem [protected]
uint QMenuData::badSize [protected]

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'