返回介绍

QMenuData Class

发布于 2019-10-04 15:01:35 字数 32410 浏览 867 评论 0 收藏 0

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

#include <qmenudata.h>

Inherited by QMenuBar and QPopupMenu.

List of all member functions.

Public Members

  • QMenuData ()
  • virtual ~QMenuData ()
  • uint count () const
  • int insertItem ( constQString&text, constQObject*receiver, constchar*member, constQKeySequence&accel = 0, intid = -1, intindex = -1 )
  • int insertItem ( constQIconSet&icon, constQString&text, constQObject*receiver, constchar*member, constQKeySequence&accel = 0, intid = -1, intindex = -1 )
  • int insertItem ( constQPixmap&pixmap, constQObject*receiver, constchar*member, constQKeySequence&accel = 0, intid = -1, intindex = -1 )
  • int insertItem ( constQIconSet&icon, constQPixmap&pixmap, constQObject*receiver, constchar*member, constQKeySequence&accel = 0, intid = -1, intindex = -1 )
  • int insertItem ( constQString&text, intid = -1, intindex = -1 )
  • int insertItem ( constQIconSet&icon, constQString&text, intid = -1, intindex = -1 )
  • int insertItem ( constQString&text, QPopupMenu*popup, intid = -1, intindex = -1 )
  • int insertItem ( constQIconSet&icon, constQString&text, QPopupMenu*popup, intid = -1, intindex = -1 )
  • int insertItem ( constQPixmap&pixmap, intid = -1, intindex = -1 )
  • int insertItem ( constQIconSet&icon, constQPixmap&pixmap, intid = -1, intindex = -1 )
  • int insertItem ( constQPixmap&pixmap, QPopupMenu*popup, intid = -1, intindex = -1 )
  • int insertItem ( constQIconSet&icon, constQPixmap&pixmap, QPopupMenu*popup, intid = -1, intindex = -1 )
  • int insertItem ( QWidget*widget, intid = -1, intindex = -1 )
  • int insertItem ( constQIconSet&icon, QCustomMenuItem*custom, intid = -1, intindex = -1 )
  • int insertItem ( QCustomMenuItem*custom, intid = -1, intindex = -1 )
  • int insertSeparator ( intindex = -1 )
  • void removeItem ( intid )
  • void removeItemAt ( intindex )
  • void clear ()
  • QKeySequence accel ( intid ) const
  • void setAccel ( constQKeySequence&key, intid )
  • QIconSet * iconSet ( intid ) const
  • QString text ( intid ) const
  • QPixmap * pixmap ( intid ) const
  • void setWhatsThis ( intid, constQString&text )
  • QString whatsThis ( intid ) const
  • void changeItem ( intid, constQString&text )
  • void changeItem ( intid, constQPixmap&pixmap )
  • void changeItem ( intid, constQIconSet&icon, constQString&text )
  • void changeItem ( intid, constQIconSet&icon, constQPixmap&pixmap )
  • void changeItem ( constQString&text, intid ) (obsolete)
  • void changeItem ( constQPixmap&pixmap, intid ) (obsolete)
  • void changeItem ( constQIconSet&icon, constQString&text, intid ) (obsolete)
  • bool isItemActive ( intid ) const
  • bool isItemEnabled ( intid ) const
  • void setItemEnabled ( intid, boolenable )
  • bool isItemChecked ( intid ) const
  • void setItemChecked ( intid, boolcheck )
  • virtual void updateItem ( intid )
  • int indexOf ( intid ) const
  • int idAt ( intindex ) const
  • virtual void setId ( intindex, intid )
  • bool connectItem ( intid, constQObject*receiver, constchar*member )
  • bool disconnectItem ( intid, constQObject*receiver, constchar*member )
  • bool setItemParameter ( intid, intparam )
  • int itemParameter ( intid ) const
  • QMenuItem * findItem ( intid ) const
  • QMenuItem * findItem ( intid, QMenuData**parent ) const
  • virtual void activateItemAt ( intindex )

Protected Members

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

Detailed Description

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

QMenuData has an internal list of menu items. A menu item is a text, pixmap or separator, and may also have a popup menu (separators have no popup menus).

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 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() or changed with changeItem(). 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.

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

See also QAccel, QPopupMenu, QAction and Miscellaneous Classes.


Member Function Documentation

QMenuData::QMenuData ()

Constructs an empty menu data list.

QMenuData::~QMenuData () [virtual]

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

QKeySequence QMenuData::accel ( intid ) const

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

See also setAccel(), QAccel and qnamespace.h.

void QMenuData::activateItemAt ( intindex ) [virtual]

Activates the menu item at position index.

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

void QMenuData::changeItem ( intid, constQString&text )

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

See also text().

void QMenuData::changeItem ( intid, constQPixmap&pixmap )

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

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

See also pixmap().

void QMenuData::changeItem ( intid, constQIconSet&icon, constQString&text )

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

Changes the iconset and text of the menu item id to the icon and text respectively.

See also pixmap().

void QMenuData::changeItem ( intid, constQIconSet&icon, constQPixmap&pixmap )

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

Changes the iconset and pixmap of the menu item id to icon and pixmap respectively.

See also pixmap().

void QMenuData::changeItem ( constQString&text, intid )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

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

See also text().

void QMenuData::changeItem ( constQPixmap&pixmap, intid )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

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

See also pixmap().

void QMenuData::changeItem ( constQIconSet&icon, constQString&text, intid )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

Changes the icon and text of the menu item id.

See also pixmap().

void QMenuData::clear ()

Removes all menu items.

See also removeItem() and removeItemAt().

Examples: mdi/application.cpp and qwerty/qwerty.cpp.

bool QMenuData::connectItem ( intid, constQObject*receiver, constchar*member )

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

The receiver's slot/signal is activated when the menu item is activated.

See also disconnectItem() and setItemParameter().

Example: menu/menu.cpp.

uint QMenuData::count () const

Returns the number of items in the menu.

bool QMenuData::disconnectItem ( intid, constQObject*receiver, constchar*member )

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

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

See also connectItem() and setItemParameter().

QMenuItem * QMenuData::findItem ( intid ) const

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

See also indexOf().

Example: chart/chartform.cpp.

QMenuItem * QMenuData::findItem ( intid, QMenuData**parent ) const

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

Returns a pointer to 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.

See also indexOf().

QIconSet* QMenuData::iconSet ( intid ) const

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

See also changeItem(), text() and pixmap().

int QMenuData::idAt ( intindex ) const

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

See also setId() and indexOf().

int QMenuData::indexOf ( intid ) const

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

See also idAt() and findItem().

Example: scrollview/scrollview.cpp.

int QMenuData::insertItem ( constQString&text, constQObject*receiver, constchar*member, constQKeySequence&accel = 0, intid = -1, intindex = -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 to existing menus or pulldown menus to 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 these items.

If you need to translate accelerators, use tr() with a string description that use pass to the QKeySequence constructor:

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

In the example above, pressing Ctrl+N 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 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.

Warning: 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.

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

See also removeItem(), changeItem(), setAccel(), connectItem(), QAccel and qnamespace.h.

Examples: addressbook/mainwindow.cpp, canvas/canvas.cpp, mdi/application.cpp, menu/menu.cpp, qwerty/qwerty.cpp, scrollview/scrollview.cpp and showimg/showimg.cpp.

int QMenuData::insertItem ( constQIconSet&icon, constQString&text, constQObject*receiver, constchar*member, constQKeySequence&accel = 0, intid = -1, intindex = -1 )

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

Inserts a menu item with icon icon, text text, accelerator accel, optional id id, and optional index. 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).

See also removeItem(), changeItem(), setAccel(), connectItem(), QAccel and qnamespace.h.

int QMenuData::insertItem ( constQPixmap&pixmap, constQObject*receiver, constchar*member, constQKeySequence&accel = 0, intid = -1, intindex = -1 )

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

Inserts a menu item with pixmap pixmap, accelerator accel, optional id id, and optional index. 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).

See also removeItem(), changeItem(), setAccel() and connectItem().

int QMenuData::insertItem ( constQIconSet&icon, constQPixmap&pixmap, constQObject*receiver, constchar*member, constQKeySequence&accel = 0, intid = -1, intindex = -1 )

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

Inserts a menu item with icon icon, pixmap pixmap, accelerator accel, optional id id, and optional index. 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).

See also removeItem(), changeItem(), setAccel(), connectItem(), QAccel and qnamespace.h.

int QMenuData::insertItem ( constQString&text, intid = -1, intindex = -1 )

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

Inserts a menu item with text text, optional id id, and optional index.

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

See also removeItem(), changeItem(), setAccel() and connectItem().

int QMenuData::insertItem ( constQIconSet&icon, constQString&text, intid = -1, intindex = -1 )

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

Inserts a menu item with icon icon, text text, optional id id, and optional index. The icon will be displayed to the left of the text in the item.

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

See also removeItem(), changeItem(), setAccel() and connectItem().

int QMenuData::insertItem ( constQString&text, QPopupMenu*popup, intid = -1, intindex = -1 )

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

Inserts a menu item with text text, submenu popup, optional id id, and optional index.

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).

See also removeItem(), changeItem(), setAccel() and connectItem().

int QMenuData::insertItem ( constQIconSet&icon, constQString&text, QPopupMenu*popup, intid = -1, intindex = -1 )

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

Inserts a menu item with icon icon, text text, submenu popup, optional id id, and optional index. 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).

See also removeItem(), changeItem(), setAccel() and connectItem().

int QMenuData::insertItem ( constQPixmap&pixmap, intid = -1, intindex = -1 )

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

Inserts a menu item with pixmap pixmap, optional id id, and optional index.

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).

See also removeItem(), changeItem(), setAccel() and connectItem().

int QMenuData::insertItem ( constQIconSet&icon, constQPixmap&pixmap, intid = -1, intindex = -1 )

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

Inserts a menu item with icon icon, pixmap pixmap, optional id id, and optional index. The icon will be displayed to the left of the pixmap in the item.

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

See also removeItem(), changeItem(), setAccel() and connectItem().

int QMenuData::insertItem ( constQPixmap&pixmap, QPopupMenu*popup, intid = -1, intindex = -1 )

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

Inserts a menu item with pixmap pixmap, submenu popup, optional id id, and optional index.

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).

See also removeItem(), changeItem(), setAccel() and connectItem().

int QMenuData::insertItem ( constQIconSet&icon, constQPixmap&pixmap, QPopupMenu*popup, intid = -1, intindex = -1 )

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

Inserts a menu item with icon icon, pixmap pixmap submenu popup, optional id id, and optional index. 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).

See also removeItem(), changeItem(), setAccel() and connectItem().

int QMenuData::insertItem ( QWidget*widget, intid = -1, intindex = -1 )

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

Inserts a menu item that consists of the widget widget with optional id id, and optional index.

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).

See also removeItem().

int QMenuData::insertItem ( constQIconSet&icon, QCustomMenuItem*custom, intid = -1, intindex = -1 )

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

Inserts a custom menu item custom with an icon and with optional id id, and optional index.

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 certain slot, use connectItem().

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

See also connectItem(), removeItem() and QCustomMenuItem.

int QMenuData::insertItem ( QCustomMenuItem*custom, intid = -1, intindex = -1 )

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

Inserts a custom menu item custom with optional id id, and optional index.

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 certain slot, use connectItem().

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

See also connectItem(), removeItem() and QCustomMenuItem.

int QMenuData::insertSeparator ( intindex = -1 )

Inserts a separator at position index. 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).

Examples: addressbook/mainwindow.cpp, mdi/application.cpp, menu/menu.cpp, progress/progress.cpp, scrollview/scrollview.cpp, showimg/showimg.cpp and sound/sound.cpp.

bool QMenuData::isItemActive ( intid ) const

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

bool QMenuData::isItemChecked ( intid ) const

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

See also setItemChecked().

Examples: canvas/canvas.cpp, progress/progress.cpp and showimg/showimg.cpp.

bool QMenuData::isItemEnabled ( intid ) const

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

See also setItemEnabled().

int QMenuData::itemParameter ( intid ) 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.

See also connectItem(), disconnectItem() and setItemParameter().

void QMenuData::menuContentsChanged () [virtual protected]

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

Reimplemented in QMenuBar.

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

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

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

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

void QMenuData::menuStateChanged () [virtual protected]

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

Reimplemented in QMenuBar.

QPixmap* QMenuData::pixmap ( intid ) const

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

See also changeItem(), text() and iconSet().

void QMenuData::removeItem ( intid )

Removes the menu item that has the identifier id.

See also removeItemAt() and clear().

Example: chart/chartform.cpp.

void QMenuData::removeItemAt ( intindex )

Removes the menu item at position index.

See also removeItem() and clear().

void QMenuData::setAccel ( constQKeySequence&key, intid )

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 );      // Control and O to open
    fileMenu->insertItem( "Quit", 69 );          // add "Quit" item
    fileMenu->setAccel( CTRL + ALT + Key_Delete, 69 );
    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.

See also accel(), insertItem(), QAccel and QAction.

Example: menu/menu.cpp.

void QMenuData::setId ( intindex, intid ) [virtual]

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

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

See also idAt().

void QMenuData::setItemChecked ( intid, boolcheck )

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.

See also isItemChecked().

Examples: canvas/canvas.cpp, grapher/grapher.cpp, mdi/application.cpp, menu/menu.cpp, progress/progress.cpp, scrollview/scrollview.cpp and showimg/showimg.cpp.

void QMenuData::setItemEnabled ( intid, boolenable )

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

See also isItemEnabled().

Examples: mdi/application.cpp, menu/menu.cpp, progress/progress.cpp and showimg/showimg.cpp.

bool QMenuData::setItemParameter ( intid, intparam )

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

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

See also connectItem(), disconnectItem() and itemParameter().

Example: mdi/application.cpp.

void QMenuData::setWhatsThis ( intid, constQString&text )

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

See also whatsThis().

Examples: application/application.cpp and mdi/application.cpp.

QString QMenuData::text ( intid ) const

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

See also changeItem(), pixmap() and iconSet().

Examples: qdir/qdir.cpp and showimg/showimg.cpp.

void QMenuData::updateItem ( intid ) [virtual]

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

Reimplemented in QPopupMenu.

QString QMenuData::whatsThis ( intid ) const

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

See also setWhatsThis().

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文