📄 qpopupmenu.3qt
字号:
'\" t.TH QPopupMenu 3qt "24 January 2005" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQPopupMenu \- Popup menu widget.br.PP\fC#include <qpopupmenu.h>\fR.PPInherits QFrame and QMenuData..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQPopupMenu\fR ( QWidget * " "parent" "=0, const char * " "name" "=0 ) ".br.ti -1c.BI "\fB~QPopupMenu\fR () ".br.ti -1c.BI "void \fBpopup\fR ( const QPoint & " "pos" ", int " "indexAtPoint" " = 0 ) ".br.ti -1c.BI "virtual void \fBupdateItem\fR ( int id ) ".br.ti -1c.BI "virtual void \fBsetCheckable\fR ( bool ) ".br.ti -1c.BI "bool \fBisCheckable\fR () const".br.ti -1c.BI "int \fBexec\fR () ".br.ti -1c.BI "int \fBexec\fR ( const QPoint & " "pos" ", int " "indexAtPoint" " = 0 ) ".br.ti -1c.BI "virtual void \fBsetActiveItem\fR ( int ) ".br.ti -1c.BI "int \fBidAt\fR ( int index ) const".br.ti -1c.BI "int \fBidAt\fR ( const QPoint & pos ) const".br.ti -1c.BI "int \fBinsertTearOffHandle\fR ( int " "id" "=-1, int " "index" "=-1 ) ".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBactivated\fR ( int itemId ) ".br.ti -1c.BI "void \fBhighlighted\fR ( int itemId ) ".br.ti -1c.BI "void \fBactivatedRedirect\fR ( int itemId ) (internal)".br.ti -1c.BI "void \fBhighlightedRedirect\fR ( int itemId ) (internal)".br.ti -1c.BI "void \fBaboutToShow\fR () ".br.ti -1c.BI "void \fBaboutToHide\fR () ".br.in -1c.SS "Important Inherited Members".in +1c.ti -1c.BI "int \fBinsertItem\fR ( QCustomMenuItem * " "custom" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( QWidget * " "widget" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QIconSet & " "icon" ", QCustomMenuItem * " "custom" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QIconSet & " "icon" ", const QPixmap & " "pixmap" ", QPopupMenu * " "popup" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QIconSet & " "icon" ", const QPixmap & " "pixmap" ", const QObject * " "receiver" ", const char * " "member" ", int " "accel" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QIconSet & " "icon" ", const QPixmap & " "pixmap" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QIconSet & " "icon" ", const QString & " "text" ", QPopupMenu * " "popup" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QIconSet & " "icon" ", const QString & " "text" ", const QObject * " "receiver" ", const char * " "member" ", int " "accel" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QIconSet & " "icon" ", const QString & " "text" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QPixmap & " "pixmap" ", QPopupMenu * " "popup" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QPixmap & " "pixmap" ", const QObject * " "receiver" ", const char * " "member" ", int " "accel" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QPixmap & " "pixmap" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QString & " "text" ", QPopupMenu * " "popup" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QString & " "text" ", const QObject * " "receiver" ", const char * " "member" ", int " "accel" ", int " "id" ", int index ) ".br.ti -1c.BI "int \fBinsertItem\fR ( const QString & " "text" ", int " "id" ", int index ) ".br.ti -1c.BI "void \fBremoveItem\fR ( int id ) ".br.ti -1c.BI "void \fBremoveItemAt\fR ( int index ) ".br.ti -1c.BI "void \fBclear\fR () ".br.ti -1c.BI "QString \fBtext\fR ( int id ) const".br.ti -1c.BI "QPixmap* \fBpixmap\fR ( int id ) const".br.ti -1c.BI "QIconSet* \fBiconSet\fR ( int id ) const".br.ti -1c.BI "int \fBinsertSeparator\fR ( int index ) ".br.ti -1c.BI "void \fBchangeItem\fR ( int " "id" ", const QIconSet & " "icon" ", const QPixmap & pixmap ) ".br.ti -1c.BI "void \fBchangeItem\fR ( int " "id" ", const QIconSet & " "icon" ", const QString & text ) ".br.ti -1c.BI "void \fBchangeItem\fR ( int " "id" ", const QPixmap & pixmap ) ".br.ti -1c.BI "void \fBchangeItem\fR ( int " "id" ", const QString & text ) ".br.ti -1c.BI "QString \fBwhatsThis\fR ( int id ) const".br.ti -1c.BI "void \fBsetWhatsThis\fR ( int " "id" ", const QString & text ) ".br.ti -1c.BI "int \fBaccel\fR ( int id ) const".br.ti -1c.BI "void \fBsetAccel\fR ( int " "key" ", int id ) ".br.ti -1c.BI "void \fBsetItemEnabled\fR ( int " "id" ", bool enable ) ".br.ti -1c.BI "bool \fBisItemEnabled\fR ( int id ) const".br.ti -1c.BI "void \fBsetItemChecked\fR ( int " "id" ", bool check ) ".br.ti -1c.BI "bool \fBisItemChecked\fR ( int id ) const".br.ti -1c.BI "bool \fBconnectItem\fR ( int " "id" ", const QObject * " "receiver" ", const char * member ) ".br.ti -1c.BI "bool \fBdisconnectItem\fR ( int " "id" ", const QObject * " "receiver" ", const char * member ) ".br.ti -1c.BI "bool \fBsetItemParameter\fR ( int " "id" ", int param ) ".br.ti -1c.BI "int \fBitemParameter\fR ( int id ) const".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "int \fBitemHeight\fR ( int ) const".br.ti -1c.BI "int \fBitemHeight\fR ( QMenuItem * mi ) const".br.ti -1c.BI "void \fBdrawItem\fR ( QPainter * " "p" ", int " "tab" ", QMenuItem * " "mi" ", bool " "act" ", int " "x" ", int " "y" ", int " "w" ", int h ) ".br.ti -1c.BI "virtual void \fBdrawContents\fR ( QPainter * ) ".br.ti -1c.BI "int \fBcolumns\fR () const".br.in -1c.SS "Properties".nf.TSl l l l l- - - - -l l l l l.Type Name READ WRITE Optionsbool checkable isCheckable setCheckable.TE.fi.SH DESCRIPTIONThe QPopupMenu class provides a popup menu widget..PPA popup menu widget is a selection menu. It can be both, 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 hits the specified shortcut key. Use QMenuBar::insertItem() to insert a popup menu into a menu bar. Show a context menu either asynchronously with popup() or synchronously with exec()..PPTechnically, a popup menu consists of a list of menu items. You add items with insertItem(). An item is either a string, a pixmap or a custom item that provides its own drawing function (see QCustomMenuItem). In addition, items can have an optional icon drawn on the very left side and an accelerator key, like "Ctrl-X"..PPThere are three kind of menu items: separators, those that perform an action and those that show a submenu. Separators are inserted with insertSeparator(). For submenus, you pass a pointer to a QPopupMenu in your call to insertItem(). All other items are considered action items..PPWhen inserting actions items, you usually specify a receiver and a slot. The receiver will be notified whenever the item was selected. In addition, QPopupMenu provides two signals activated() and highlighted() that signal the identifier of the respective menu item. Sometimes it is practical to connect several items to one slot. To distinguish between them, specify a slot that takes an integer argument and use setItemParameter() to associate a unique value with each item..PPYou clear a popup menu with clear() and remove single items with removeItem() or removeItemAt()..PPA popup menu can display check marks for certain items when enabled with setCheckable(TRUE). You check or uncheck items with setItemChecked()..PPItems are either enabled or disabled. You toggle their state with setItemEnabled(). Just before a popup menu becomes visible, it emits the aboutToShow() signal. You can use this signal to set the correct enabled/disabled states of all menu items before the user sees it. The corresponding aboutToHide() signal is emitted when the menu hides again..PPYou can provide What's This? help for single menu items with setWhatsThis(). See QWhatsThis for general information about this kind of light-weight online help..PPFor ultimate flexibility, you can also add entire widgets as items into a popup menu, for example a color selector..PPA QPopupMenu can also provide a tear-off menu. A tear-off menu is a" torn off" copy of a menu that lives in a separate window. 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 that functionality for a certain menu, insert a tear-off handle with insertTearOffHandle(). When using tear-off menus, keep in mind that the concept isn't typically used on MS-Windows, so users may not be familiar with it. Consider using a QToolBar instead..PPmenu/menu.cpp is a typical example of QMenuBar and QPopupMenu use..PP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -