⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qmenudata.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 3 页
字号:
.PPSee also removeItem(), changeItem(), setAccel(), and connectItem()..SH "int QMenuData::insertItem ( QWidget * widget, int id = -1, int index = -1 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts a menu item that consists of the widget \fIwidget\fR with optional id \fIid\fR, and optional \fIindex\fR position..PPOwnership of \fIwidget\fR is transferred to the popup menu or to the menu bar..PPTheoretically, any widget can be inserted into a popup menu. In practice, this only makes sense with certain widgets..PPIf 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..PPIf 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 \fCArrowUp\fR and \fCArrowDown\fR 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:.PP.nf.br        if ( isVisible() &&.br             parentWidget() &&.br             parentWidget()->inherits("QPopupMenu") ).br            parentWidget()->close();.br.fi.PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem()..SH "int QMenuData::insertItem ( const QIconSet & icon, QCustomMenuItem * custom, int id = -1, int index = -1 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts a custom menu item \fIcustom\fR with an \fIicon\fR and with optional id \fIid\fR, and optional \fIindex\fR position..PPThis only works with popup menus. It is not supported for menu bars. Ownership of \fIcustom\fR is transferred to the popup menu..PPIf you want to connect a custom item to a slot, use connectItem()..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also connectItem(), removeItem(), and QCustomMenuItem..SH "int QMenuData::insertItem ( QCustomMenuItem * custom, int id = -1, int index = -1 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts a custom menu item \fIcustom\fR with optional id \fIid\fR, and optional \fIindex\fR position..PPThis only works with popup menus. It is not supported for menu bars. Ownership of \fIcustom\fR is transferred to the popup menu..PPIf you want to connect a custom item to a slot, use connectItem()..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also connectItem(), removeItem(), and QCustomMenuItem..SH "int QMenuData::insertSeparator ( int index = -1 )"Inserts a separator at position \fIindex\fR. The separator becomes the last menu item if \fIindex\fR is negative..PPIn 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)..PPExamples:.)l addressbook/mainwindow.cpp, mdi/application.cpp, menu/menu.cpp, progress/progress.cpp, scrollview/scrollview.cpp, showimg/showimg.cpp, and sound/sound.cpp..SH "bool QMenuData::isItemActive ( int id ) const"Returns TRUE if the menu item with the id \fIid\fR is currently active; otherwise returns FALSE..SH "bool QMenuData::isItemChecked ( int id ) const"Returns TRUE if the menu item with the id \fIid\fR has been checked; otherwise returns FALSE..PPSee also setItemChecked()..PPExamples:.)l canvas/canvas.cpp, progress/progress.cpp, and showimg/showimg.cpp..SH "bool QMenuData::isItemEnabled ( int id ) const"Returns TRUE if the item with identifier \fIid\fR is enabled; otherwise returns FALSE.PPSee also setItemEnabled() and isItemVisible()..SH "bool QMenuData::isItemVisible ( int id ) const"Returns TRUE if the menu item with the id \fIid\fR is visible; otherwise returns FALSE..PPSee also setItemVisible()..SH "int QMenuData::itemParameter ( int id ) const"Returns the parameter of the activation signal of item \fIid\fR..PPIf no parameter has been specified for this item with setItemParameter(), the value defaults to \fIid\fR..PPSee also connectItem(), disconnectItem(), and setItemParameter()..SH "void QMenuData::menuContentsChanged ()\fC [virtual protected]\fR"Virtual function; notifies subclasses that one or more items have been inserted or removed..PPReimplemented in QMenuBar..SH "void QMenuData::menuDelPopup ( QPopupMenu * )\fC [virtual protected]\fR"Virtual function; notifies subclasses that a popup menu item has been removed..SH "void QMenuData::menuInsPopup ( QPopupMenu * )\fC [virtual protected]\fR"Virtual function; notifies subclasses that a popup menu item has been inserted..SH "void QMenuData::menuStateChanged ()\fC [virtual protected]\fR"Virtual function; notifies subclasses that one or more items have changed state (enabled/disabled or checked/unchecked)..PPReimplemented in QMenuBar..SH "QPixmap * QMenuData::pixmap ( int id ) const"Returns the pixmap that has been set for menu item \fIid\fR, or 0 if no pixmap has been set..PPSee also changeItem(), text(), and iconSet()..SH "void QMenuData::removeItem ( int id )"Removes the menu item that has the identifier \fIid\fR..PPSee also removeItemAt() and clear()..PPExample: chart/chartform.cpp..SH "void QMenuData::removeItemAt ( int index )"Removes the menu item at position \fIindex\fR..PPSee also removeItem() and clear()..SH "void QMenuData::setAccel ( const QKeySequence & key, int id )"Sets the accelerator key for the menu item \fIid\fR to \fIkey\fR..PPAn accelerator key consists of a key code and a combination of the modifiers \fCSHIFT\fR, \fCCTRL\fR, \fCALT\fR or \fCUNICODE_ACCEL\fR (OR'ed or added). The header file qnamespace.h contains a list of key codes..PPDefining an accelerator key produces a text that is added to the menu item; for instance, \fCCTRL\fR + \fCKey_O\fR produces "Ctrl+O". The text is formatted differently for different platforms..PPNote 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..PPExample:.PP.nf.br        QMenuBar *mainMenu = new QMenuBar;.br        QPopupMenu *fileMenu = new QPopupMenu;       // file sub menu.br        fileMenu->insertItem( "Open Document", 67 ); // add "Open" item.br        fileMenu->setAccel( CTRL + Key_O, 67 );      // Ctrl+O to open.br        fileMenu->insertItem( "Quit", 69 );          // add "Quit" item.br        fileMenu->setAccel( CTRL + ALT + Key_Delete, 69 ); // add Alt+Del to quit.br        mainMenu->insertItem( "File", fileMenu );    // add the file menu.br.fi.PPIf you need to translate accelerators, use tr() with a string:.PP.nf.br        fileMenu->setAccel( tr("Ctrl+O"), 67 );.br.fi.PPYou can also specify the accelerator in the insertItem() function. You may prefer to use QAction to associate accelerators with menu items..PPSee also accel(), insertItem(), QAccel, and QAction..PPExample: menu/menu.cpp..SH "void QMenuData::setId ( int index, int id )\fC [virtual]\fR"Sets the menu identifier of the item at \fIindex\fR to \fIid\fR..PPIf \fIindex\fR is out of range, the operation is ignored..PPSee also idAt()..SH "void QMenuData::setItemChecked ( int id, bool check )"If \fIcheck\fR is TRUE, checks the menu item with id \fIid\fR; otherwise unchecks the menu item with id \fIid\fR. Calls QPopupMenu::setCheckable( TRUE ) if necessary..PPSee also isItemChecked()..PPExamples:.)l canvas/canvas.cpp, mdi/application.cpp, menu/menu.cpp, progress/progress.cpp, scrollview/scrollview.cpp, and showimg/showimg.cpp..SH "void QMenuData::setItemEnabled ( int id, bool enable )"If \fIenable\fR is TRUE, enables the menu item with identifier \fIid\fR; otherwise disables the menu item with identifier \fIid\fR..PPSee also isItemEnabled()..PPExamples:.)l mdi/application.cpp, menu/menu.cpp, progress/progress.cpp, and showimg/showimg.cpp..SH "bool QMenuData::setItemParameter ( int id, int param )"Sets the parameter of the activation signal of item \fIid\fR to \fIparam\fR..PPIf any receiver takes an integer parameter, this value is passed..PPSee also connectItem(), disconnectItem(), and itemParameter()..PPExample: mdi/application.cpp..SH "void QMenuData::setItemVisible ( int id, bool visible )"If \fIvisible\fR is TRUE, shows the menu item with id \fIid\fR; otherwise hides the menu item with id \fIid\fR..PPSee also isItemVisible() and isItemEnabled()..SH "void QMenuData::setWhatsThis ( int id, const QString & text )"Sets \fItext\fR as What's This help for the menu item with identifier \fIid\fR..PPSee also whatsThis()..PPExamples:.)l application/application.cpp and mdi/application.cpp..SH "QString QMenuData::text ( int id ) const"Returns the text that has been set for menu item \fIid\fR, or QString::null if no text has been set..PPSee also changeItem(), pixmap(), and iconSet()..PPExamples:.)l qdir/qdir.cpp and showimg/showimg.cpp..SH "void QMenuData::updateItem ( int id )\fC [virtual]\fR"Virtual function; notifies subclasses about an item with \fIid\fR that has been changed..PPReimplemented in QPopupMenu..SH "QString QMenuData::whatsThis ( int id ) const"Returns the What's This help text for the item with identifier \fIid\fR or QString::null if no text has yet been defined..PPSee also setWhatsThis()..SH "SEE ALSO".BR http://doc.trolltech.com/qmenudata.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qmenudata.3qt) and the Qtversion (3.1.1).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -