<tdalign="right"valign="center"><imgsrc="logo32.png"align="right"width="64"height="32"border="0"></td></tr></table><h1align=center>TQPopupMenu Class Reference</h1>
<p>The TQPopupMenu class provides a popup menu widget.
<p> This signal is emitted just before the popup menu is hidden after
it has been displayed.
<p><b>Warning:</b> Do not open a widget in a slot connected to this signal.
<p><p>See also <ahref="#aboutToShow">aboutToShow</a>(), <ahref="qmenudata.html#setItemEnabled">setItemEnabled</a>(), <ahref="qmenudata.html#setItemChecked">setItemChecked</a>(), <ahref="qmenudata.html#insertItem">insertItem</a>(), and <ahref="qmenudata.html#removeItem">removeItem</a>().
<p> This signal is emitted just before the popup menu is displayed.
You can connect it to any slot that sets up the menu contents
(e.g. to ensure that the right items are enabled).
<p><p>See also <ahref="#aboutToHide">aboutToHide</a>(), <ahref="qmenudata.html#setItemEnabled">setItemEnabled</a>(), <ahref="qmenudata.html#setItemChecked">setItemChecked</a>(), <ahref="qmenudata.html#insertItem">insertItem</a>(), and <ahref="qmenudata.html#removeItem">removeItem</a>().
<p>Examples: <ahref="fileiconview-example.html#x866">fileiconview/qfileiconview.cpp</a>, <ahref="menu-example.html#x1878">menu/menu.cpp</a>, and <ahref="scribble-example.html#x923">scribble/scribble.cpp</a>.
Returns the icon set that has been set for menu item <em>id</em>, or 0
if no icon set has been set.
<p><p>See also <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#text">text</a>(), and <ahref="qmenudata.html#pixmap">pixmap</a>().
<p> In the example above, pressing Ctrl+O or selecting "Open" from the
menu activates the myView->open() function.
<p> Some insert functions take a <ahref="qiconset.html">TQIconSet</a> parameter to specify the
little menu item icon. Note that you can always pass a <ahref="qpixmap.html">TQPixmap</a>
object instead.
<p> The <em>id</em> specifies the identification number associated with the
menu item. Note that only positive values are valid, as a negative
value will make TQt select a unique id for the item.
<p> The <em>index</em> specifies the position in the menu. The menu item is
appended at the end of the list if <em>index</em> is negative.
<p> Note that keyboard accelerators in TQt are not application-global,
instead they are bound to a certain top-level window. For example,
accelerators in TQPopupMenu 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 <ahref="qwidget.html#parentWidget">parentWidget</a>()
chain. The menu will then install its accelerator object on that
top-level widget. For all other cases use an independent <ahref="qaccel.html">TQAccel</a>
object.
<p><b>Warning:</b> Be careful when passing a literal 0 to <ahref="qmenudata.html#insertItem">insertItem</a>()
because some C++ compilers choose the wrong overloaded function.
Cast the 0 to what you mean, e.g. <tt>(TQObject*)0</tt>.
<p><b>Warning:</b> On Mac OS X, items that connect to a slot that are inserted into a
menubar will not function as we use the native menubar that knows nothing
about signals or slots. Instead insert the items into a popup menu and
insert the popup menu into the menubar. This may be fixed in a future TQt
version.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qaccel.html">TQAccel</a>, and <ahref="qnamespace-h.html">qnamespace.h</a>.
<p>Examples: <ahref="addressbook-example.html#x569">addressbook/mainwindow.cpp</a>, <ahref="canvas-example.html#x2936">canvas/canvas.cpp</a>, <ahref="menu-example.html#x1869">menu/menu.cpp</a>, <ahref="qwerty-example.html#x371">qwerty/qwerty.cpp</a>, <ahref="scrollview-example.html#x634">scrollview/scrollview.cpp</a>, <ahref="showimg-example.html#x1327">showimg/showimg.cpp</a>, and <ahref="sound-example.html#x2810">sound/sound.cpp</a>.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, text <em>text</em>, accelerator
<em>accel</em>, optional id <em>id</em>, and optional <em>index</em> position. The
menu item is connected it to the <em>receiver</em>'s <em>member</em> slot. The
icon will be displayed to the left of the text in the item.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qaccel.html">TQAccel</a>, and <ahref="qnamespace-h.html">qnamespace.h</a>.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with pixmap <em>pixmap</em>, accelerator <em>accel</em>,
optional id <em>id</em>, and optional <em>index</em> position. The menu item
is connected it to the <em>receiver</em>'s <em>member</em> slot. The icon will
be displayed to the left of the text in the item.
<p> To look best when being highlighted as a menu item, the pixmap
should provide a mask (see <ahref="qpixmap.html#mask">TQPixmap::mask</a>()).
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, pixmap <em>pixmap</em>,
accelerator <em>accel</em>, optional id <em>id</em>, and optional <em>index</em>
position. The icon will be displayed to the left of the pixmap in
the item. The item is connected to the <em>member</em> slot in the <em>receiver</em> object.
<p> To look best when being highlighted as a menu item, the pixmap
should provide a mask (see <ahref="qpixmap.html#mask">TQPixmap::mask</a>()).
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qaccel.html">TQAccel</a>, and <ahref="qnamespace-h.html">qnamespace.h</a>.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with text <em>text</em>, optional id <em>id</em>, and
optional <em>index</em> position.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, text <em>text</em>, optional id
<em>id</em>, and optional <em>index</em> position. The icon will be displayed
to the left of the text in the item.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with text <em>text</em>, submenu <em>popup</em>, optional
id <em>id</em>, and optional <em>index</em> position.
<p> The <em>popup</em> 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.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, text <em>text</em>, submenu <em>popup</em>, optional id <em>id</em>, and optional <em>index</em> position. The icon
will be displayed to the left of the text in the item.
<p> The <em>popup</em> 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.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with pixmap <em>pixmap</em>, optional id <em>id</em>, and
optional <em>index</em> position.
<p> To look best when being highlighted as a menu item, the pixmap
should provide a mask (see <ahref="qpixmap.html#mask">TQPixmap::mask</a>()).
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, pixmap <em>pixmap</em>, optional
id <em>id</em>, and optional <em>index</em> position. The icon will be
displayed to the left of the pixmap in the item.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with pixmap <em>pixmap</em>, submenu <em>popup</em>,
optional id <em>id</em>, and optional <em>index</em> position.
<p> The <em>popup</em> 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.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a menu item with icon <em>icon</em>, pixmap <em>pixmap</em> submenu <em>popup</em>, optional id <em>id</em>, and optional <em>index</em> position. The icon
will be displayed to the left of the pixmap in the item.
<p> The <em>popup</em> 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.
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#removeItem">removeItem</a>(), <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#setAccel">setAccel</a>(), and <ahref="qmenudata.html#connectItem">connectItem</a>().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a custom menu item <em>custom</em> with an <em>icon</em> and with
optional id <em>id</em>, and optional <em>index</em> position.
<p> This only works with popup menus. It is not supported for menu
bars. Ownership of <em>custom</em> is transferred to the popup menu.
<p> If you want to connect a custom item to a slot, use <ahref="qmenudata.html#connectItem">connectItem</a>().
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qmenudata.html#removeItem">removeItem</a>(), and <ahref="qcustommenuitem.html">TQCustomMenuItem</a>.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Inserts a custom menu item <em>custom</em> with optional id <em>id</em>, and
optional <em>index</em> position.
<p> This only works with popup menus. It is not supported for menu
bars. Ownership of <em>custom</em> is transferred to the popup menu.
<p> If you want to connect a custom item to a slot, use <ahref="qmenudata.html#connectItem">connectItem</a>().
<p> Returns the allocated <ahref="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
<p><p>See also <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qmenudata.html#removeItem">removeItem</a>(), and <ahref="qcustommenuitem.html">TQCustomMenuItem</a>.
Returns TRUE if the menu item with the id <em>id</em> has been checked;
otherwise returns FALSE.
<p><p>See also <ahref="qmenudata.html#setItemChecked">setItemChecked</a>().
<p>Examples: <ahref="canvas-example.html#x2938">canvas/canvas.cpp</a>, <ahref="progress-example.html#x70">progress/progress.cpp</a>, and <ahref="showimg-example.html#x1329">showimg/showimg.cpp</a>.
Returns the parameter of the activation signal of item <em>id</em>.
<p> If no parameter has been specified for this item with
<ahref="qmenudata.html#setItemParameter">setItemParameter</a>(), the value defaults to <em>id</em>.
<p><p>See also <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qmenudata.html#disconnectItem">disconnectItem</a>(), and <ahref="qmenudata.html#setItemParameter">setItemParameter</a>().
Returns the pixmap that has been set for menu item <em>id</em>, or 0 if
no pixmap has been set.
<p><p>See also <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#text">text</a>(), and <ahref="qmenudata.html#iconSet">iconSet</a>().
Sets the accelerator key for the menu item <em>id</em> to <em>key</em>.
<p> An accelerator key consists of a key code and a combination of the
modifiers <ahref="qt.html#Modifier-enum">SHIFT</a>, <ahref="qt.html#Modifier-enum">CTRL</a>, <ahref="qt.html#Modifier-enum">ALT</a> or <ahref="qt.html#Modifier-enum">UNICODE_ACCEL</a> (OR'ed or
added). The header file <ahref="qnamespace-h.html">qnamespace.h</a> contains a list of key
codes.
<p> Defining an accelerator key produces a text that is added to the
menu item; for instance, <ahref="qt.html#Modifier-enum">CTRL</a> + <ahref="qt.html#Key-enum">Key_O</a> produces "Ctrl+O". The
text is formatted differently for different platforms.
<p> Note that keyboard accelerators in TQt are not application-global,
instead they are bound to a certain top-level window. For example,
accelerators in TQPopupMenu 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 <ahref="qwidget.html#parentWidget">parentWidget</a>()
chain. The menu will then install its accelerator object on that
top-level widget. For all other cases use an independent <ahref="qaccel.html">TQAccel</a>
object.
<p> Example:
<pre>
<ahref="qmenubar.html">TQMenuBar</a> *mainMenu = new <ahref="qmenubar.html">TQMenuBar</a>;
TQPopupMenu *fileMenu = new TQPopupMenu; // file sub menu
<p> You can also specify the accelerator in the <ahref="qmenudata.html#insertItem">insertItem</a>() function.
You may prefer to use <ahref="qaction.html">TQAction</a> to associate accelerators with menu
items.
<p><p>See also <ahref="qmenudata.html#accel">accel</a>(), <ahref="qmenudata.html#insertItem">insertItem</a>(), <ahref="qaccel.html">TQAccel</a>, and <ahref="qaction.html">TQAction</a>.
Sets the parameter of the activation signal of item <em>id</em> to <em>param</em>.
<p> If any receiver takes an integer parameter, this value is passed.
<p><p>See also <ahref="qmenudata.html#connectItem">connectItem</a>(), <ahref="qmenudata.html#disconnectItem">disconnectItem</a>(), and <ahref="qmenudata.html#itemParameter">itemParameter</a>().
Sets <em>text</em> as What's This help for the menu item with identifier
<em>id</em>.
<p><p>See also <ahref="qmenudata.html#whatsThis">whatsThis</a>().
<p>Examples: <ahref="simple-application-example.html#x1554">application/application.cpp</a>, <ahref="helpsystem-example.html#x2689">helpsystem/mainwindow.cpp</a>, and <ahref="mdi-example.html#x2035">mdi/application.cpp</a>.
Returns the text that has been set for menu item <em>id</em>, or
<ahref="qstring.html#TQString-null">TQString::null</a> if no text has been set.
<p><p>See also <ahref="qmenudata.html#changeItem">changeItem</a>(), <ahref="qmenudata.html#pixmap">pixmap</a>(), and <ahref="qmenudata.html#iconSet">iconSet</a>().
<p>Examples: <ahref="qdir-example.html#x1831">qdir/qdir.cpp</a> and <ahref="showimg-example.html#x1332">showimg/showimg.cpp</a>.
Returns the What's This help text for the item with identifier <em>id</em> or <ahref="qstring.html#TQString-null">TQString::null</a> if no text has yet been defined.
<p><p>See also <ahref="qmenudata.html#setWhatsThis">setWhatsThis</a>().
<p>This property holds whether the display of check marks on menu items is enabled.
<p>When TRUE, the display of check marks on menu items is enabled.
Checking is always enabled when in Windows-style.
<p><p>See also <ahref="qmenudata.html#setItemChecked">TQMenuData::setItemChecked</a>().
<p>Set this property's value with <ahref="#setCheckable">setCheckable</a>() and get this property's value with <ahref="#isCheckable">isCheckable</a>().
<!-- eof -->
<hr><p>
This file is part of the <ahref="index.html">TQt toolkit</a>.