QMenu Class Reference

The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus.

  1. #include <QMenu>

Inherits: QWidget.

Inherited by: Q3PopupMenu.

Detailed Description

The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus.

A menu widget is a selection menu. It can be either a pull-down menu in a menu bar or a standalone context menu. Pull-down menus are shown by the menu bar when the user clicks on the respective item or presses the specified shortcut key. Use QMenuBar::addMenu() to insert a menu into a menu bar. Context menus are usually invoked by some special keyboard key or by right-clicking. They can be executed either asynchronously with popup() or synchronously with exec(). Menus can also be invoked in response to button presses; these are just like context menus except for how they are invoked.

Fig. A menu shown in Plastique widget style, Windows XP widget style, and Macintosh widget style.

Actions

A menu consists of a list of action items. Actions are added with the addAction(), addActions() and insertAction() functions. An action is represented vertically and rendered by QStyle. In addition, actions can have a text label, an optional icon drawn on the very left side, and shortcut key sequence such as "Ctrl+X".

The existing actions held by a menu can be found with actions().

There are four kinds of action items: separators, actions that show a submenu, widgets, and actions that perform an action. Separators are inserted with addSeparator(), submenus with addMenu(), and all other items are considered action items.

When inserting action items you usually specify a receiver and a slot. The receiver will be notifed whenever the item is triggered(). In addition, QMenu provides two signals, activated() and highlighted(), which signal the QAction that was triggered from the menu.

You clear a menu with clear() and remove individual action items with removeAction().

A QMenu can also provide a tear-off menu. A tear-off menu is a top-level window that contains a copy of the menu. This makes it possible for the user to "tear off" frequently used menus and position them in a convenient place on the screen. If you want this functionality for a particular menu, insert a tear-off handle with setTearOffEnabled(). When using tear-off menus, bear in mind that the concept isn't typically used on Microsoft Windows so some users may not be familiar with it. Consider using a QToolBar instead.

Widgets can be inserted into menus with the QWidgetAction class. Instances of this class are used to hold widgets, and are inserted into menus with the addAction() overload that takes a QAction.

Conversely, actions can be added to widgets with the addAction(), addActions() and insertAction() functions.

Warning: To make QMenu visible on the screen, exec() or popup() should be used instead of show().

QMenu on Qt for Windows CE

If a menu is integrated into the native menubar on Windows Mobile we do not support the signals: aboutToHide (), aboutToShow () and hovered (). It is not possible to display an icon in a native menu on Windows Mobile.

QMenu on Mac OS X with Qt build against Cocoa

QMenu can be inserted only once in a menu/menubar. Subsequent insertions will have no effect or will result in a disabled menu item.

See the Menus example for an example of how to use QMenuBar and QMenu in your application.

Important inherited functions: addAction(), removeAction(), clear(), addSeparator(), and addMenu().

See also QMenuBar, GUI Design Handbook: Menu, Drop-Down and Pop-Up, Application Example, Menus Example, and Recent Files Example.

Properties

Toggle detailsiconicon : QIcon

This property holds The icon of the menu

This is equivalent to the QAction::icon property of the menuAction().

By default, if no icon is explicitly set, this property contains a null icon.

Access functions:

  • void setIcon ( const QIcon & icon )

Look up this member in the source code.

Toggle detailsseparatorsCollapsibleseparatorsCollapsible : bool

This property holds whether consecutive separators should be collapsed

This property specifies whether consecutive separators in the menu should be visually collapsed to a single one. Separators at the beginning or the end of the menu are also hidden.

By default, this property is true.

Access functions:

Look up this member in the source code.

Toggle detailstearOffEnabledtearOffEnabled : bool

This property holds whether the menu supports being torn off

When true, the menu contains a special tear-off item (often shown as a dashed line at the top of the menu) that creates a copy of the menu when it is triggered.

This "torn-off" copy lives in a separate window. It contains the same menu items as the original menu, with the exception of the tear-off handle.

By default, this property is false.

Access functions:

Look up this member in the source code.

Toggle detailstitletitle : QString

This property holds The title of the menu

This is equivalent to the QAction::text property of the menuAction().

By default, this property contains an empty string.

Access functions:

Look up this member in the source code.

    Public Functions

    Toggle details QMenu

    QMenuQMenu ( QWidget *parent=0 ) ( QWidget *parent=0 )

    Constructs a menu with parent parent.

    Although a popup menu is always a top-level widget, if a parent is passed the popup menu will be deleted when that parent is destroyed (as with any other QObject).

    Look up this member in the source code.

    Toggle details QMenu

    QMenuQMenu ( const QString &title , QWidget *parent=0 ) ( const QString &title , QWidget *parent=0 )

    Constructs a menu with a title and a parent.

    Although a popup menu is always a top-level widget, if a parent is passed the popup menu will be deleted when that parent is destroyed (as with any other QObject).

    See also title.

    Look up this member in the source code.

    Toggle details QMenu

    ~QMenu~QMenu () ()

    Destroys the menu.

    Look up this member in the source code.

    Toggle details QAction * QMenu

    actionAtactionAt ( const QPoint &pt ) ( const QPoint &pt )const

    Returns the item at pt; returns 0 if there is no item there.

    Look up this member in the source code.

    Toggle details void QMenu

    actionEventactionEvent ( QActionEvent *e ) ( QActionEvent *e ) [virtual protected]

    Reimplemented from QWidget::actionEvent().

    Look up this member in the source code.

    Toggle details QRect QMenu

    actionGeometryactionGeometry ( QAction *act ) ( QAction *act )const

    Returns the geometry of action act.

    Look up this member in the source code.

    Toggle details QAction * QMenu

    activeActionactiveAction () ()const

    Returns the currently highlighted action, or 0 if no action is currently highlighted.

    See also setActiveAction().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    addActionaddAction ( const QString &text ) ( const QString &text )

    This is an overloaded function.

    This convenience function creates a new action with text. The function adds the newly created action to the menu's list of actions, and returns it.

    See also QWidget::addAction().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    addActionaddAction ( const QIcon &icon , const QString &text ...) ( const QIcon &icon , const QString &text )

    This is an overloaded function.

    This convenience function creates a new action with an icon and some text. The function adds the newly created action to the menu's list of actions, and returns it.

    See also QWidget::addAction().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    addActionaddAction ( const QString &text , const QObject *receiver , const char *member , const QKeySequence &shortcut=0 ...) ( const QString &text , const QObject *receiver , const char *member , const QKeySequence &shortcut=0 )

    This is an overloaded function.

    This convenience function creates a new action with the text text and an optional shortcut shortcut. The action's triggered() signal is connected to the receiver's member slot. The function adds the newly created action to the menu's list of actions and returns it.

    See also QWidget::addAction().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    addActionaddAction ( const QIcon &icon , const QString &text , const QObject *receiver , const char *member , const QKeySequence &shortcut=0 ...) ( const QIcon &icon , const QString &text , const QObject *receiver , const char *member , const QKeySequence &shortcut=0 )

    This is an overloaded function.

    This convenience function creates a new action with an icon and some text and an optional shortcut shortcut. The action's triggered() signal is connected to the member slot of the receiver object. The function adds the newly created action to the menu's list of actions, and returns it.

    See also QWidget::addAction().

    Look up this member in the source code.

    Toggle details void QMenu

    addActionaddAction ( QAction *action ) ( QAction *action )

    This is an overloaded function.

    Appends the action action to the menu's list of actions.

    See also QMenuBar::addAction() and QWidget::addAction().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    addMenuaddMenu ( QMenu *menu ) ( QMenu *menu )

    This convenience function adds menu as a submenu to this menu. It returns menu's menuAction(). This menu does not take ownership of menu.

    See also QWidget::addAction() and QMenu::menuAction().

    Look up this member in the source code.

    Toggle details QMenu * QMenu

    addMenuaddMenu ( const QString &title ) ( const QString &title )

    Appends a new QMenu with title to the menu. The menu takes ownership of the menu. Returns the new menu.

    See also QWidget::addAction() and QMenu::menuAction().

    Look up this member in the source code.

    Toggle details QMenu * QMenu

    addMenuaddMenu ( const QIcon &icon , const QString &title ...) ( const QIcon &icon , const QString &title )

    Appends a new QMenu with icon and title to the menu. The menu takes ownership of the menu. Returns the new menu.

    See also QWidget::addAction() and QMenu::menuAction().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    addSeparatoraddSeparator () ()

    This convenience function creates a new separator action, i.e. an action with QAction::isSeparator() returning true, and adds the new action to this menu's list of actions. It returns the newly created action.

    See also QWidget::addAction().

    Look up this member in the source code.

    Toggle details void QMenu

    changeEventchangeEvent ( QEvent *e ) ( QEvent *e ) [virtual protected]

    Reimplemented from QWidget::changeEvent().

    Look up this member in the source code.

    Toggle details void QMenu

    clearclear () ()

    Removes all the menu's actions. Actions owned by the menu and not shown in any other widget are deleted.

    See also removeAction().

    Look up this member in the source code.

    Toggle details int QMenu

    columnCountcolumnCount () ()const[protected]

    If a menu does not fit on the screen it lays itself out so that it does fit. It is style dependent what layout means (for example, on Windows it will use multiple columns).

    This functions returns the number of columns necessary.

    Look up this member in the source code.

    Toggle details QAction * QMenu

    defaultActiondefaultAction () ()const

    Returns the current default action.

    See also setDefaultAction().

    Look up this member in the source code.

    Toggle details void QMenu

    enterEvententerEvent ( QEvent * ) ( QEvent * ) [virtual protected]

    Reimplemented from QWidget::enterEvent().

    Look up this member in the source code.

    Toggle details bool QMenu

    eventevent ( QEvent *e ) ( QEvent *e ) [virtual protected]

    Reimplemented from QObject::event().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    execexec () ()

    Executes this menu synchronously.

    This is equivalent to exec(pos()).

    This returns the triggered QAction in either the popup menu or one of its submenus, or 0 if no item was triggered (normally because the user pressed Esc).

    In most situations you'll want to specify the position yourself, for example, the current mouse position:

    1. exec(QCursor::pos());

    or aligned to a widget:

    1. exec(somewidget.mapToGlobal(QPoint(0,0)));

    or in reaction to a QMouseEvent *e:

    1. exec(e->globalPos());

    Look up this member in the source code.

    Toggle details QAction * QMenu

    execexec ( const QPoint &p , QAction *action=0 ...) ( const QPoint &p , QAction *action=0 )

    This is an overloaded function.

    Executes this menu synchronously.

    Pops up the menu so that the action action will be at the specified global position p. To translate a widget's local coordinates into global coordinates, use QWidget::mapToGlobal().

    This returns the triggered QAction in either the popup menu or one of its submenus, or 0 if no item was triggered (normally because the user pressed Esc).

    Note that all signals are emitted as usual. If you connect a QAction to a slot and call the menu's exec(), you get the result both via the signal-slot connection and in the return value of exec().

    Common usage is to position the menu at the current mouse position:

    1. exec(QCursor::pos());

    or aligned to a widget:

    1. exec(somewidget.mapToGlobal(QPoint(0, 0)));

    or in reaction to a QMouseEvent *e:

    1. exec(e->globalPos());

    When positioning a menu with exec() or popup(), bear in mind that you cannot rely on the menu's current size(). For performance reasons, the menu adapts its size only when necessary. So in many cases, the size before and after the show is different. Instead, use sizeHint() which calculates the proper size depending on the menu's current contents.

    See also popup() and QWidget::mapToGlobal().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    execexec ( QList <QAction *>actions , const QPoint &pos , QAction *at , QWidget *parent ...) ( QList <QAction *>actions , const QPoint &pos , QAction *at , QWidget *parent ) [static]

    This is an overloaded function.

    Executes a menu synchronously.

    The menu's actions are specified by the list of actions. The menu will pop up so that the specified action, at, appears at global position pos. If at is not specified then the menu appears at position pos. parent is the menu's parent widget; specifying the parent will provide context when pos alone is not enough to decide where the menu should go (e.g., with multiple desktops or when the parent is embedded in QGraphicsView).

    The function returns the triggered QAction in either the popup menu or one of its submenus, or 0 if no item was triggered (normally because the user pressed Esc).

    This is equivalent to:

    1.                     QMenu menu;
    2. QAction *at = actions[0]; // Assumes actions is not empty
    3. foreach (QAction *a, actions)
    4.     menu.addAction(a);
    5. menu.exec(pos, at);

    See also popup() and QWidget::mapToGlobal().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    execexec ( QList <QAction *>actions , const QPoint &pos , QAction *at=0 ...) ( QList <QAction *>actions , const QPoint &pos , QAction *at=0 ) [static]

    This is an overloaded function.

    Executes a menu synchronously.

    The menu's actions are specified by the list of actions. The menu will pop up so that the specified action, at, appears at global position pos. If at is not specified then the menu appears at position pos.

    The function returns the triggered QAction in either the popup menu or one of its submenus, or 0 if no item was triggered (normally because the user pressed Esc).

    This is equivalent to:

    1.                     QMenu menu;
    2. QAction *at = actions[0]; // Assumes actions is not empty
    3. foreach (QAction *a, actions)
    4.     menu.addAction(a);
    5. menu.exec(pos, at);

    See also popup() and QWidget::mapToGlobal().

    Look up this member in the source code.

    Toggle details bool QMenu

    focusNextPrevChildfocusNextPrevChild ( bool next ) ( bool next ) [virtual protected]

    Reimplemented from QWidget::focusNextPrevChild().

    Look up this member in the source code.

    Toggle details void QMenu

    hideEventhideEvent ( QHideEvent * ) ( QHideEvent * ) [virtual protected]

    Reimplemented from QWidget::hideEvent().

    Look up this member in the source code.

    Toggle details void QMenu

    hideTearOffMenuhideTearOffMenu () ()

    This function will forcibly hide the torn off menu making it disappear from the users desktop.

    See also isTearOffMenuVisible() and isTearOffEnabled().

    Look up this member in the source code.

    Toggle details void QMenu

    initStyleOptioninitStyleOption ( QStyleOptionMenuItem *option , const QAction *action ...) ( QStyleOptionMenuItem *option , const QAction *action )const[protected]

    Initialize option with the values from this menu and information from action. This method is useful for subclasses when they need a QStyleOptionMenuItem, but don't want to fill in all the information themselves.

    See also QStyleOption::initFrom() and QMenuBar::initStyleOption().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    insertMenuinsertMenu ( QAction *before , QMenu *menu ( QAction *before , QMenu *menu )

    This convenience function inserts menu before action before and returns the menus menuAction().

    See also QWidget::insertAction() and addMenu().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    insertSeparatorinsertSeparator ( QAction *before ) ( QAction *before )

    This convenience function creates a new separator action, i.e. an action with QAction::isSeparator() returning true. The function inserts the newly created action into this menu's list of actions before action before and returns it.

    See also QWidget::insertAction() and addSeparator().

    Look up this member in the source code.

    Toggle details bool QMenu

    isEmptyisEmpty () ()const

    Returns true if there are no visible actions inserted into the menu, false otherwise.

    See also QWidget::actions().

    Look up this member in the source code.

    Toggle details bool QMenu

    isTearOffMenuVisibleisTearOffMenuVisible () ()const

    When a menu is torn off a second menu is shown to display the menu contents in a new window. When the menu is in this mode and the menu is visible returns true; otherwise false.

    See also hideTearOffMenu() and isTearOffEnabled().

    Look up this member in the source code.

    Toggle details void QMenu

    keyPressEventkeyPressEvent ( QKeyEvent *e ) ( QKeyEvent *e ) [virtual protected]

    Reimplemented from QWidget::keyPressEvent().

    Look up this member in the source code.

    Toggle details void QMenu

    leaveEventleaveEvent ( QEvent * ) ( QEvent * ) [virtual protected]

    Reimplemented from QWidget::leaveEvent().

    Look up this member in the source code.

    Toggle details QAction * QMenu

    menuActionmenuAction () ()const

    Returns the action associated with this menu.

    Look up this member in the source code.

    Toggle details void QMenu

    mouseMoveEventmouseMoveEvent ( QMouseEvent *e ) ( QMouseEvent *e ) [virtual protected]

    Reimplemented from QWidget::mouseMoveEvent().

    Look up this member in the source code.

    Toggle details void QMenu

    mousePressEventmousePressEvent ( QMouseEvent *e ) ( QMouseEvent *e ) [virtual protected]

    Reimplemented from QWidget::mousePressEvent().

    Look up this member in the source code.

    Toggle details void QMenu

    mouseReleaseEventmouseReleaseEvent ( QMouseEvent *e ) ( QMouseEvent *e ) [virtual protected]

    Reimplemented from QWidget::mouseReleaseEvent().

    Look up this member in the source code.

    Toggle details void QMenu

    paintEventpaintEvent ( QPaintEvent *e ) ( QPaintEvent *e ) [virtual protected]

    Reimplemented from QWidget::paintEvent().

    Look up this member in the source code.

    Toggle details void QMenu

    popuppopup ( const QPoint &p , QAction *atAction=0 ( const QPoint &p , QAction *atAction=0 )

    Displays the menu so that the action atAction will be at the specified global position p. To translate a widget's local coordinates into global coordinates, use QWidget::mapToGlobal().

    When positioning a menu with exec() or popup(), bear in mind that you cannot rely on the menu's current size(). For performance reasons, the menu adapts its size only when necessary, so in many cases, the size before and after the show is different. Instead, use sizeHint() which calculates the proper size depending on the menu's current contents.

    See also QWidget::mapToGlobal() and exec().

    Look up this member in the source code.

    Toggle details void QMenu

    setActiveActionsetActiveAction ( QAction *act ) ( QAction *act )

    Sets the currently highlighted action to act.

    See also activeAction().

    Look up this member in the source code.

    Toggle details void QMenu

    setDefaultActionsetDefaultAction ( QAction *act ) ( QAction *act )

    This sets the default action to act. The default action may have a visual cue, depending on the current QStyle. A default action usually indicates what will happen by default when a drop occurs.

    See also defaultAction().

    Look up this member in the source code.

    Toggle details QSize QMenu

    sizeHintsizeHint () ()const [virtual]

    Reimplemented from QWidget::sizeHint().

    Look up this member in the source code.

    Toggle details void QMenu

    timerEventtimerEvent ( QTimerEvent *e ) ( QTimerEvent *e ) [virtual protected]

    Reimplemented from QObject::timerEvent().

    Look up this member in the source code.

    Toggle details void QMenu

    wheelEventwheelEvent ( QWheelEvent *e ) ( QWheelEvent *e ) [virtual protected]

    Reimplemented from QWidget::wheelEvent().

    Look up this member in the source code.

    Toggle details QKeySequence QMenu

    accelaccel ( int id ) ( int id )const Qt3-support

    Use shortcut() on the relevant QAction instead.

    See also setAccel().

    Look up this member in the source code.

    Toggle details void QMenu

    activateItemAtactivateItemAt ( int index ) ( int index ) Qt3-support

    Use activate() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details void QMenu

    changeItemchangeItem ( int id , const QString &text ) ( int id , const QString &text ) Qt3-support

    Use setText() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details void QMenu

    changeItemchangeItem ( int id , const QPixmap &pixmap ) ( int id , const QPixmap &pixmap ) Qt3-support

    Use setText() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details void QMenu

    changeItemchangeItem ( int id , const QIcon &icon , const QString &text ...) ( int id , const QIcon &icon , const QString &text ) Qt3-support

    Use setIcon() and setText() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details int QMenu

    columnscolumns () ()const[protected] Qt3-support

    Use columnCount() instead.

    Look up this member in the source code.

    Toggle details bool QMenu

    connectItemconnectItem ( int id , const QObject *receiver , const char *member ...) ( int id , const QObject *receiver , const char *member ) Qt3-support

    Use connect() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details uint QMenu

    countcount () ()const Qt3-support

    Use actions().count() instead.

    Look up this member in the source code.

    Toggle details bool QMenu

    disconnectItemdisconnectItem ( int id , const QObject *receiver , const char *member ...) ( int id , const QObject *receiver , const char *member ) Qt3-support

    Use disconnect() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details QMenuItem * QMenu

    findItemfindItem ( int id ) ( int id )const Qt3-support

    Use actions instead.

    Look up this member in the source code.

    Toggle details QMenuItem * QMenu

    findPopupfindPopup ( QMenu *popup , int *index ) ( QMenu *popup , int *index ) Qt3-support

    Use QAction and actions() instead.

    Look up this member in the source code.

    Toggle details int QMenu

    frameWidthframeWidth () ()const Qt3-support

    Use style()->pixelMetric(QStyle::PM_MenuPanelWidth, this) instead.

    Look up this member in the source code.

    Toggle details QIcon QMenu

    iconSeticonSet ( int id ) ( int id )const Qt3-support

    Use icon() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details int QMenu

    idAtidAt ( int index ) ( int index )const Qt3-support

    Use actions instead.

    Look up this member in the source code.

    Toggle details int QMenu

    indexOfindexOf ( int id ) ( int id )const Qt3-support

    Use actions().indexOf(action) on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertIteminsertItem ( const QString &text , const QObject *receiver , const char *member , const QKeySequence &shortcut=0 , int id=-1 , int index=-1 ...) ( const QString &text , const QObject *receiver , const char *member , const QKeySequence &shortcut=0 , int id=-1 , int index=-1 ) Qt3-support

    Use insertAction() or one of the addAction() overloads instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertIteminsertItem ( const QIcon &icon , const QString &text , const QObject *receiver , const char *member , const QKeySequence &shortcut=0 , int id=-1 , int index=-1 ...) ( const QIcon &icon , const QString &text , const QObject *receiver , const char *member , const QKeySequence &shortcut=0 , int id=-1 , int index=-1 ) Qt3-support

    Use insertAction() or one of the addAction() overloads instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertIteminsertItem ( const QPixmap &pixmap , const QObject *receiver , const char *member , const QKeySequence &shortcut=0 , int id=-1 , int index=-1 ...) ( const QPixmap &pixmap , const QObject *receiver , const char *member , const QKeySequence &shortcut=0 , int id=-1 , int index=-1 ) Qt3-support

    Use insertAction() or one of the addAction() overloads instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertIteminsertItem ( const QString &text , int id=-1 , int index=-1 ...) ( const QString &text , int id=-1 , int index=-1 ) Qt3-support

    Use insertAction() or one of the addAction() overloads instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertIteminsertItem ( const QIcon &icon , const QString &text , int id=-1 , int index=-1 ...) ( const QIcon &icon , const QString &text , int id=-1 , int index=-1 ) Qt3-support

    Use insertAction() or one of the addAction() overloads instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertIteminsertItem ( const QString &text , QMenu *popup , int id=-1 , int index=-1 ...) ( const QString &text , QMenu *popup , int id=-1 , int index=-1 ) Qt3-support

    Use insertMenu() or one of the addMenu() overloads instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertIteminsertItem ( const QIcon &icon , const QString &text , QMenu *popup , int id=-1 , int index=-1 ...) ( const QIcon &icon , const QString &text , QMenu *popup , int id=-1 , int index=-1 ) Qt3-support

    Use insertMenu() or one of the addMenu() overloads instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertIteminsertItem ( const QPixmap &pixmap , int id=-1 , int index=-1 ...) ( const QPixmap &pixmap , int id=-1 , int index=-1 ) Qt3-support

    Use insertAction() or one of the addAction() overloads instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertIteminsertItem ( const QPixmap &pixmap , QMenu *popup , int id=-1 , int index=-1 ...) ( const QPixmap &pixmap , QMenu *popup , int id=-1 , int index=-1 ) Qt3-support

    Use insertMenu() or one of the addMenu() overloads instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertIteminsertItem ( QMenuItem *item , int id=-1 , int index=-1 ...) ( QMenuItem *item , int id=-1 , int index=-1 ) Qt3-support

    Use insertAction() or one of the addAction() overloads instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertSeparatorinsertSeparator ( int index=-1 ) ( int index=-1 ) Qt3-support

    Use the insertSeparator() overload that takes a QAction * parameter instead.

    Look up this member in the source code.

    Toggle details int QMenu

    insertTearOffHandleinsertTearOffHandle ( int a=0 , int b=0 ) ( int a=0 , int b=0 ) Qt3-support

    Use setTearOffEnabled() instead.

    Look up this member in the source code.

    Toggle details bool QMenu

    isCheckableisCheckable () ()const Qt3-support

    Not necessary anymore. Always returns true.

    Look up this member in the source code.

    Toggle details bool QMenu

    isItemActiveisItemActive ( int id ) ( int id )const Qt3-support

    Use activeAction() instead.

    Look up this member in the source code.

    Toggle details bool QMenu

    isItemCheckedisItemChecked ( int id ) ( int id )const Qt3-support

    Use isChecked() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details bool QMenu

    isItemEnabledisItemEnabled ( int id ) ( int id )const Qt3-support

    Use isEnabled() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details bool QMenu

    isItemVisibleisItemVisible ( int id ) ( int id )const Qt3-support

    Use isVisible() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details int QMenu

    itemAtPositemAtPos ( const QPoint &p , bool ignoreSeparator=true ...) ( const QPoint &p , bool ignoreSeparator=true )[protected] Qt3-support

    Use actions instead.

    Look up this member in the source code.

    Toggle details QFont QMenu

    itemFontitemFont ( int id ) ( int id )const Qt3-support

    Use font() on the relevant QAction instead.

    See also setItemFont().

    Look up this member in the source code.

    Toggle details QRect QMenu

    itemGeometryitemGeometry ( int index ) ( int index ) Qt3-support

    Use actionGeometry() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details int QMenu

    itemHeightitemHeight ( int index ) ( int index )[protected] Qt3-support

    Use actionGeometry(actions().value(index)).height() instead.

    Look up this member in the source code.

    Toggle details int QMenu

    itemHeightitemHeight ( QMenuItem *mi ) ( QMenuItem *mi )[protected] Qt3-support

    Use actionGeometry() instead.

    Look up this member in the source code.

    Toggle details int QMenu

    itemParameteritemParameter ( int id ) ( int id )const Qt3-support

    Use QAction::data() instead.

    See also setItemParameter().

    Look up this member in the source code.

    Toggle details QPixmap QMenu

    pixmappixmap ( int id ) ( int id )const Qt3-support

    Use QPixmap(icon()) on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details void QMenu

    popuppopup ( const QPoint &pos , int indexAtPoint ) ( const QPoint &pos , int indexAtPoint ) Qt3-support

    Use popup() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details void QMenu

    removeItemremoveItem ( int id ) ( int id ) Qt3-support

    Use removeAction() instead.

    Look up this member in the source code.

    Toggle details void QMenu

    removeItemAtremoveItemAt ( int index ) ( int index ) Qt3-support

    Use removeAction() instead.

    Look up this member in the source code.

    Toggle details void QMenu

    setAccelsetAccel ( const QKeySequence &key , int id ) ( const QKeySequence &key , int id ) Qt3-support

    Use setShortcut() on the relevant QAction instead.

    See also accel().

    Look up this member in the source code.

    Toggle details void QMenu

    setActiveItemsetActiveItem ( int id ) ( int id ) Qt3-support

    Use setActiveAction() instead.

    Look up this member in the source code.

    Toggle details void QMenu

    setCheckablesetCheckable ( bool checkable ) ( bool checkable ) Qt3-support

    Not necessary anymore. The checkable parameter is ignored.

    See also isCheckable().

    Look up this member in the source code.

    Toggle details void QMenu

    setIdsetId ( int index , int id ) ( int index , int id ) Qt3-support

    Use actions instead.

    Look up this member in the source code.

    Toggle details void QMenu

    setItemCheckedsetItemChecked ( int id , bool check ) ( int id , bool check ) Qt3-support

    Use setChecked() on the relevant QAction instead.

    See also isItemChecked().

    Look up this member in the source code.

    Toggle details void QMenu

    setItemEnabledsetItemEnabled ( int id , bool enable ) ( int id , bool enable ) Qt3-support

    Use setEnabled() on the relevant QAction instead.

    See also isItemEnabled().

    Look up this member in the source code.

    Toggle details void QMenu

    setItemFontsetItemFont ( int id , const QFont &font ) ( int id , const QFont &font ) Qt3-support

    Use setFont() on the relevant QAction instead.

    See also itemFont().

    Look up this member in the source code.

    Toggle details bool QMenu

    setItemParametersetItemParameter ( int id , int param ) ( int id , int param ) Qt3-support

    Use QAction::setData() instead.

    See also itemParameter().

    Look up this member in the source code.

    Toggle details void QMenu

    setItemVisiblesetItemVisible ( int id , bool visible ) ( int id , bool visible ) Qt3-support

    Use setVisible() on the relevant QAction instead.

    See also isItemVisible().

    Look up this member in the source code.

    Toggle details void QMenu

    setWhatsThissetWhatsThis ( int id , const QString &w ) ( int id , const QString &w ) Qt3-support

    Use setWhatsThis() on the relevant QAction instead.

    See also whatsThis().

    Look up this member in the source code.

    Toggle details QString QMenu

    texttext ( int id ) ( int id )const Qt3-support

    Use text() on the relevant QAction instead.

    Look up this member in the source code.

    Toggle details QString QMenu

    whatsThiswhatsThis ( int id ) ( int id )const Qt3-support

    Use whatsThis() on the relevant QAction instead.

    See also setWhatsThis().

    Look up this member in the source code.

    Signals

    Toggle details void QMenu

    aboutToHideaboutToHide () () [signal]

    This signal is emitted just before the menu is hidden from the user.

    See also aboutToShow() and hide().

    Look up this member in the source code.

    Toggle details void QMenu

    aboutToShowaboutToShow () () [signal]

    This signal is emitted just before the menu is shown to the user.

    See also aboutToHide() and show().

    Look up this member in the source code.

    Toggle details void QMenu

    hoveredhovered ( QAction *action ) ( QAction *action ) [signal]

    This signal is emitted when a menu action is highlighted; action is the action that caused the signal to be emitted.

    Often this is used to update status information.

    See also triggered() and QAction::hovered().

    Look up this member in the source code.

    Toggle details void QMenu

    triggeredtriggered ( QAction *action ) ( QAction *action ) [signal]

    This signal is emitted when an action in this menu is triggered.

    action is the action that caused the signal to be emitted.

    Normally, you connect each menu action's triggered() signal to its own custom slot, but sometimes you will want to connect several actions to a single slot, for example, when you have a group of closely related actions, such as "left justify", "center", "right justify".

    Note: This signal is emitted for the main parent menu in a hierarchy. Hence, only the parent menu needs to be connected to a slot; sub-menus need not be connected.

    See also hovered() and QAction::triggered().

    Look up this member in the source code.

    Toggle details void QMenu

    activatedactivated ( int itemId ) ( int itemId ) [signal] Qt3-support

    Use triggered() instead.

    Look up this member in the source code.

    Toggle details void QMenu

    highlightedhighlighted ( int itemId ) ( int itemId ) [signal] Qt3-support

    Use hovered() instead.

    Look up this member in the source code.

    Notes provided by the Qt Community

    No notes