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

📄 qmenudata.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 3 页
字号:
.SH "void QMenuData::changeItem ( int id, const QIconSet & icon, const QString & text )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPChanges the iconset and text of the menu item \fIid\fR to the \fIicon\fR and \fItext\fR respectively..PPSee also pixmap()..SH "void QMenuData::changeItem ( int id, const QIconSet & icon, const QPixmap & pixmap )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPChanges the iconset and pixmap of the menu item \fIid\fR to \fIicon\fR and \fIpixmap\fR respectively..PPSee also pixmap()..SH "void QMenuData::changeItem ( const QString & text, int id )"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPChanges the text of the menu item \fIid\fR. If the item has an icon, the icon remains unchanged..PPSee also text()..SH "void QMenuData::changeItem ( const QPixmap & pixmap, int id )"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPChanges the pixmap of the menu item \fIid\fR. If the item has an icon, the icon remains unchanged..PPSee also pixmap()..SH "void QMenuData::changeItem ( const QIconSet & icon, const QString & text, int id )"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPChanges the icon and text of the menu item \fIid\fR..PPSee also pixmap()..SH "void QMenuData::clear ()"Removes all menu items..PPSee also removeItem() and removeItemAt()..PPExamples:.)l mdi/application.cpp and qwerty/qwerty.cpp..SH "bool QMenuData::connectItem ( int id, const QObject * receiver, const char * member )"Connects the menu item with identifier \fIid\fR to \fIreceiver\fR's \fImember\fR slot or signal..PPThe receiver's slot (or signal) is activated when the menu item is activated..PPSee also disconnectItem() and setItemParameter()..PPExample: menu/menu.cpp..SH "uint QMenuData::count () const"Returns the number of items in the menu..SH "bool QMenuData::disconnectItem ( int id, const QObject * receiver, const char * member )"Disconnects the \fIreceiver\fR's \fImember\fR from the menu item with identifier \fIid\fR..PPAll connections are removed when the menu data object is destroyed..PPSee also connectItem() and setItemParameter()..SH "QMenuItem * QMenuData::findItem ( int id ) const"Returns the menu item with identifier \fIid\fR, or 0 if there is no item with this identifier..PPSee also indexOf()..PPExample: chart/chartform.cpp..SH "QMenuItem * QMenuData::findItem ( int id, QMenuData ** parent ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns the menu item with identifier \fIid\fR, or 0 if there is no item with this identifier. Changes \fI*parent\fR to point to the parent of the return value..PPSee also indexOf()..SH "QIconSet * QMenuData::iconSet ( int id ) const"Returns the icon set that has been set for menu item \fIid\fR, or 0 if no icon set has been set..PPSee also changeItem(), text(), and pixmap()..SH "int QMenuData::idAt ( int index ) const"Returns the identifier of the menu item at position \fIindex\fR in the internal list, or -1 if \fIindex\fR is out of range..PPSee also setId() and indexOf()..SH "int QMenuData::indexOf ( int id ) const"Returns the index of the menu item with identifier \fIid\fR, or -1 if there is no item with this identifier..PPSee also idAt() and findItem()..PPExample: scrollview/scrollview.cpp..SH "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..PPA 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..PPSome 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..PPThe number of insert functions may look confusing, but they are actually quite simple to use..PPThis default version inserts a menu item with the text \fItext\fR, the accelerator key \fIaccel\fR, an id and an optional index and connects it to the slot \fImember\fR in the object \fIreceiver\fR..PPExample:.PP.nf.br        QMenuBar   *mainMenu = new QMenuBar;.br        QPopupMenu *fileMenu = new QPopupMenu;.br        fileMenu->insertItem( "New",  myView, SLOT(newFile()), CTRL+Key_N );.br        fileMenu->insertItem( "Open", myView, SLOT(open()),    CTRL+Key_O );.br        mainMenu->insertItem( "File", fileMenu );.br.fi.PPNot all insert functions take an object/slot parameter or an accelerator key. Use connectItem() and setAccel() on those items..PPIf you need to translate accelerators, use tr() with the text and accelerator. (For translations use a string key sequence.):.PP.nf.br        fileMenu->insertItem( tr("Open"), myView, SLOT(open()),.br                              tr("Ctrl+O") );.br.fi.PPIn the example above, pressing Ctrl+O or selecting "Open" from the menu activates the myView->open() function..PPSome insert functions take a QIconSet parameter to specify the little menu item icon. Note that you can always pass a QPixmap object instead..PPThe \fIindex\fR specifies the position in the menu. The menu item is appended at the end of the list if \fIindex\fR is negative..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..PP\fBWarning:\fR 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. \fC(QObject*)0\fR..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), connectItem(), QAccel, and qnamespace.h..PPExamples:.)l addressbook/mainwindow.cpp, canvas/canvas.cpp, mdi/application.cpp, menu/menu.cpp, qwerty/qwerty.cpp, scrollview/scrollview.cpp, and showimg/showimg.cpp..SH "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 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts a menu item with icon \fIicon\fR, text \fItext\fR, accelerator \fIaccel\fR, optional id \fIid\fR, and optional \fIindex\fR position. The menu item is connected it to the \fIreceiver\fR's \fImember\fR slot. The icon will be displayed to the left of the text in the item..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), connectItem(), QAccel, and qnamespace.h..SH "int QMenuData::insertItem ( const QPixmap & pixmap, const QObject * receiver, const char * member, const QKeySequence & accel = 0, 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 with pixmap \fIpixmap\fR, accelerator \fIaccel\fR, optional id \fIid\fR, and optional \fIindex\fR position. The menu item is connected it to the \fIreceiver\fR's \fImember\fR slot. The icon will be displayed to the left of the text in the item..PPTo look best when being highlighted as a menu item, the pixmap should provide a mask (see QPixmap::mask())..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), and connectItem()..SH "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 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts a menu item with icon \fIicon\fR, pixmap \fIpixmap\fR, accelerator \fIaccel\fR, optional id \fIid\fR, and optional \fIindex\fR position. The icon will be displayed to the left of the pixmap in the item. The item is connected to the \fImember\fR slot in the \fIreceiver\fR object..PPTo look best when being highlighted as a menu item, the pixmap should provide a mask (see QPixmap::mask())..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), connectItem(), QAccel, and qnamespace.h..SH "int QMenuData::insertItem ( const QString & text, 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 with text \fItext\fR, optional id \fIid\fR, and optional \fIindex\fR position..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), and connectItem()..SH "int QMenuData::insertItem ( const QIconSet & icon, const QString & text, 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 with icon \fIicon\fR, text \fItext\fR, optional id \fIid\fR, and optional \fIindex\fR position. The icon will be displayed to the left of the text in the item..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), and connectItem()..SH "int QMenuData::insertItem ( const QString & text, QPopupMenu * popup, 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 with text \fItext\fR, submenu \fIpopup\fR, optional id \fIid\fR, and optional \fIindex\fR position..PPThe \fIpopup\fR 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..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), and connectItem()..SH "int QMenuData::insertItem ( const QIconSet & icon, const QString & text, QPopupMenu * popup, 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 with icon \fIicon\fR, text \fItext\fR, submenu \fIpopup\fR, optional id \fIid\fR, and optional \fIindex\fR position. The icon will be displayed to the left of the text in the item..PPThe \fIpopup\fR 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..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), and connectItem()..SH "int QMenuData::insertItem ( const QPixmap & pixmap, 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 with pixmap \fIpixmap\fR, optional id \fIid\fR, and optional \fIindex\fR position..PPTo look best when being highlighted as a menu item, the pixmap should provide a mask (see QPixmap::mask())..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), and connectItem()..SH "int QMenuData::insertItem ( const QIconSet & icon, const QPixmap & pixmap, 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 with icon \fIicon\fR, pixmap \fIpixmap\fR, optional id \fIid\fR, and optional \fIindex\fR position. The icon will be displayed to the left of the pixmap in the item..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), and connectItem()..SH "int QMenuData::insertItem ( const QPixmap & pixmap, QPopupMenu * popup, 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 with pixmap \fIpixmap\fR, submenu \fIpopup\fR, optional id \fIid\fR, and optional \fIindex\fR position..PPThe \fIpopup\fR 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..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0)..PPSee also removeItem(), changeItem(), setAccel(), and connectItem()..SH "int QMenuData::insertItem ( const QIconSet & icon, const QPixmap & pixmap, QPopupMenu * popup, 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 with icon \fIicon\fR, pixmap \fIpixmap\fR submenu \fIpopup\fR, optional id \fIid\fR, and optional \fIindex\fR position. The icon will be displayed to the left of the pixmap in the item..PPThe \fIpopup\fR 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..PPReturns the allocated menu identifier number (\fIid\fR if \fIid\fR >= 0).

⌨️ 快捷键说明

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