1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QPopupMenu Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QPopupMenu Class Reference</h1><br clear="all">
<p>
The QPopupMenu class provides a popup menu widget.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qpopupmenu-h.html">qpopupmenu.h</a>></code>
<p>
Inherits <a href="qframe.html">QFrame</a> and <a href="qmenudata.html">QMenuData</a>.
<p><a href="qpopupmenu-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#24c864"><b>QPopupMenu</b></a>(QWidget*parent=0, constchar*name=0)</div>
<li><div class="fn"><a href="#56e52c"><b>~QPopupMenu</b></a>()</div>
<li><div class="fn">void<a href="#0d7b5f"><b>popup</b></a>(constQPoint&pos, intindexAtPoint=0)</div>
<li><div class="fn">virtualvoid<a href="#8732b1"><b>updateItem</b></a>(intid)</div>
<li><div class="fn">virtualvoid<a href="#672d77"><b>setCheckable</b></a>(bool)</div>
<li><div class="fn">bool<a href="#0ab7fe"><b>isCheckable</b></a>()const</div>
<li><div class="fn">int<a href="#aeb921"><b>exec</b></a>()</div>
<li><div class="fn">int<a href="#ac4d90"><b>exec</b></a>(constQPoint&pos, intindexAtPoint=0)</div>
<li><div class="fn">virtualvoid<a href="#2ba062"><b>setActiveItem</b></a>(int)</div>
<li><div class="fn">int<a href="#deaaee"><b>idAt</b></a>(intindex)const</div>
<li><div class="fn">int<a href="#6776f6"><b>idAt</b></a>(constQPoint&pos)const</div>
<li><div class="fn">int<a href="#27032b"><b>insertTearOffHandle</b></a>(intid=-1, intindex=-1)</div>
</ul>
<h2>Signals</h2>
<ul>
<li><div class="fn">void<a href="#b224f0"><b>activated</b></a>(intitemId)</div>
<li><div class="fn">void<a href="#4abbe8"><b>highlighted</b></a>(intitemId)</div>
<li><div class="fn">void<b>activatedRedirect</b>(intitemId)(internal)</div>
<li><div class="fn">void<b>highlightedRedirect</b>(intitemId)(internal)</div>
<li><div class="fn">void<a href="#245441"><b>aboutToShow</b></a>()</div>
<li><div class="fn">void<a href="#d6c664"><b>aboutToHide</b></a>()</div>
</ul>
<h2>Important Inherited Members</h2>
<ul>
<li><div class="fn">int<a href="qmenudata.html#230967"><b>insertItem</b></a>(QCustomMenuItem*custom, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#e53049"><b>insertItem</b></a>(QWidget*widget, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#d242f5"><b>insertItem</b></a>(constQIconSet&icon, QCustomMenuItem*custom, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#eab16a"><b>insertItem</b></a>(constQIconSet&icon, constQPixmap&pixmap, QPopupMenu*popup, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#e33289"><b>insertItem</b></a>(constQIconSet&icon, constQPixmap&pixmap, constQObject*receiver, constchar*member, intaccel, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#deddb9"><b>insertItem</b></a>(constQIconSet&icon, constQPixmap&pixmap, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#549faf"><b>insertItem</b></a>(constQIconSet&icon, constQString&text, QPopupMenu*popup, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#033c64"><b>insertItem</b></a>(constQIconSet&icon, constQString&text, constQObject*receiver, constchar*member, intaccel, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#1fb84f"><b>insertItem</b></a>(constQIconSet&icon, constQString&text, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#c8759a"><b>insertItem</b></a>(constQPixmap&pixmap, QPopupMenu*popup, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#c087c8"><b>insertItem</b></a>(constQPixmap&pixmap, constQObject*receiver, constchar*member, intaccel, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#865195"><b>insertItem</b></a>(constQPixmap&pixmap, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#0076cb"><b>insertItem</b></a>(constQString&text, QPopupMenu*popup, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#a0155e"><b>insertItem</b></a>(constQString&text, constQObject*receiver, constchar*member, intaccel, intid, intindex)</div>
<li><div class="fn">int<a href="qmenudata.html#2b0523"><b>insertItem</b></a>(constQString&text, intid, intindex)</div>
<li><div class="fn">void<a href="qmenudata.html#001b53"><b>removeItem</b></a>(intid)</div>
<li><div class="fn">void<a href="qmenudata.html#c4b64b"><b>removeItemAt</b></a>(intindex)</div>
<li><div class="fn">void<a href="qmenudata.html#4bd5e3"><b>clear</b></a>()</div>
<li><div class="fn">QString<a href="qmenudata.html#3222d1"><b>text</b></a>(intid)const</div>
<li><div class="fn">QPixmap*<a href="qmenudata.html#996263"><b>pixmap</b></a>(intid)const</div>
<li><div class="fn">QIconSet*<a href="qmenudata.html#a4f737"><b>iconSet</b></a>(intid)const</div>
<li><div class="fn">int<a href="qmenudata.html#e34b79"><b>insertSeparator</b></a>(intindex)</div>
<li><div class="fn">void<a href="qmenudata.html#ba9daa"><b>changeItem</b></a>(intid, constQIconSet&icon, constQPixmap&pixmap)</div>
<li><div class="fn">void<a href="qmenudata.html#10aed4"><b>changeItem</b></a>(intid, constQIconSet&icon, constQString&text)</div>
<li><div class="fn">void<a href="qmenudata.html#b3774c"><b>changeItem</b></a>(intid, constQPixmap&pixmap)</div>
<li><div class="fn">void<a href="qmenudata.html#b8c2e0"><b>changeItem</b></a>(intid, constQString&text)</div>
<li><div class="fn">QString<a href="qmenudata.html#a27087"><b>whatsThis</b></a>(intid)const</div>
<li><div class="fn">void<a href="qmenudata.html#88eb55"><b>setWhatsThis</b></a>(intid, constQString&text)</div>
<li><div class="fn">int<a href="qmenudata.html#b9922c"><b>accel</b></a>(intid)const</div>
<li><div class="fn">void<a href="qmenudata.html#58b23b"><b>setAccel</b></a>(intkey, intid)</div>
<li><div class="fn">void<a href="qmenudata.html#c9a23c"><b>setItemEnabled</b></a>(intid, boolenable)</div>
<li><div class="fn">bool<a href="qmenudata.html#f5c40c"><b>isItemEnabled</b></a>(intid)const</div>
<li><div class="fn">void<a href="qmenudata.html#319c05"><b>setItemChecked</b></a>(intid, boolcheck)</div>
<li><div class="fn">bool<a href="qmenudata.html#def7a0"><b>isItemChecked</b></a>(intid)const</div>
<li><div class="fn">bool<a href="qmenudata.html#d7f757"><b>connectItem</b></a>(intid, constQObject*receiver, constchar*member)</div>
<li><div class="fn">bool<a href="qmenudata.html#bc8ae2"><b>disconnectItem</b></a>(intid, constQObject*receiver, constchar*member)</div>
<li><div class="fn">bool<a href="qmenudata.html#89eb5b"><b>setItemParameter</b></a>(intid, intparam)</div>
<li><div class="fn">int<a href="qmenudata.html#8f3064"><b>itemParameter</b></a>(intid)const</div>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class="fn">int<a href="#0e5c68"><b>itemHeight</b></a>(int)const</div>
<li><div class="fn">int<a href="#043d7b"><b>itemHeight</b></a>(QMenuItem*mi)const</div>
<li><div class="fn">void<a href="#55a51e"><b>drawItem</b></a>(QPainter*p, inttab, QMenuItem*mi, boolact, intx, inty, intw, inth)</div>
<li><div class="fn">virtualvoid<a href="#7142b1"><b>drawContents</b></a>(QPainter*)</div>
<li><div class="fn">int<a href="#fc4d48"><b>columns</b></a>()const</div>
</ul>
<h2>Properties</h2>
<table border=1 cellpadding=3 cellspacing=0>
<tr><th>Type<th>Name<th>READ<th>WRITE<th>Options
<tr><td>bool<td>checkable<td>isCheckable<td>setCheckable<td>
</table>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QPopupMenu class provides a popup menu widget.
<p>
A 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 <a href="qmenudata.html#0076cb">QMenuBar::insertItem</a>()
to insert a popup menu into a menu bar. Show a context menu either
asynchronously with <a href="#0d7b5f">popup</a>() or synchronously with <a href="#ac4d90">exec</a>().
<p>Technically, a popup menu consists of a list of menu items. You add
items with <a href="qmenudata.html#0076cb">insertItem</a>(). An item is either a string, a pixmap or a
custom item that provides its own drawing function (see
<a href="qcustommenuitem.html">QCustomMenuItem</a>). In addition, items can have an optional icon drawn
on the very left side and an accelerator key, like "Ctrl-X".
<p>There are three kind of menu items: separators, those that perform
an action and those that show a submenu. Separators are inserted
with <a href="qmenudata.html#e34b79">insertSeparator</a>(). For submenus, you pass a pointer to a
QPopupMenu in your call to insertItem(). All other items are
considered action items.
<p>When 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 <a href="#b224f0">activated</a>()
and <a href="#4abbe8">highlighted</a>() 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 <a href="qmenudata.html#89eb5b">setItemParameter</a>() to associate a unique
value with each item.
<p>You clear a popup menu with <a href="qmenudata.html#4bd5e3">clear</a>() and remove single items with
<a href="qmenudata.html#001b53">removeItem</a>() or <a href="qmenudata.html#c4b64b">removeItemAt</a>().
<p>A popup menu can display check marks for certain items when enabled
with <a href="#672d77">setCheckable</a>(TRUE). You check or uncheck items with
<a href="qmenudata.html#319c05">setItemChecked</a>().
<p>Items are either enabled or disabled. You toggle their state with
<a href="qmenudata.html#c9a23c">setItemEnabled</a>(). Just before a popup menu becomes visible, it
emits the <a href="#245441">aboutToShow</a>() signal. You can use this signal to set the
correct enabled/disabled states of all menu items before the user
sees it. The corresponding <a href="#d6c664">aboutToHide</a>() signal is emitted when the
menu hides again.
<p>You can provide What's This? help for single menu items with
<a href="qmenudata.html#88eb55">setWhatsThis</a>(). See <a href="qwhatsthis.html">QWhatsThis</a> for general information about this
kind of light-weight online help.
<p>For ultimate flexibility, you can also add entire widgets as items
into a popup menu, for example a color selector.
<p>A 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
<a href="#27032b">insertTearOffHandle</a>(). 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 <a href="qtoolbar.html">QToolBar</a> instead.
<p><a href="menu-menu-cpp.html#QPopupMenu">menu/menu.cpp</a> is a typical example of <a href="qmenubar.html">QMenuBar</a> and QPopupMenu use.
<p><img src=qpopmenu-m.png> <img src=qpopmenu-w.png>
<p>See also <a href="qmenubar.html">QMenuBar</a> and <a href="guibooks.html#fowler">GUI Design Handbook: Menu, Drop-Down and Pop-Up</a>
<p>Examples:
<a href="qtimage-qtimage-cpp.html#QPopupMenu">qtimage/qtimage.cpp</a>
<a href="grapher-grapher-cpp.html#QPopupMenu">grapher/grapher.cpp</a>
<a href="mainlyQt-editor-cpp.html#QPopupMenu">mainlyQt/editor.cpp</a>
<a href="layout-layout-cpp.html#QPopupMenu">layout/layout.cpp</a>
<a href="menu-menu-cpp.html#QPopupMenu">menu/menu.cpp</a>
<a href="progress-progress-cpp.html#QPopupMenu">progress/progress.cpp</a>
<a href="scrollview-scrollview-cpp.html#QPopupMenu">scrollview/scrollview.cpp</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="24c864"></a>QPopupMenu::QPopupMenu(<a href="qwidget.html">QWidget</a>*parent=0, constchar*name=0)</h3>
<p>Constructs a popup menu with a parent and a widget name.
<p>Although a popup menu is always a top level widget, if a parent is
passed, the popup menu will be deleted on destruction of that parent
(as with any other <a href="qobject.html">QObject</a>).
<h3 class="fn"><a name="56e52c"></a>QPopupMenu::~QPopupMenu()</h3>
<p>Destructs the popup menu.
<h3 class="fn">void<a name="d6c664"></a>QPopupMenu::aboutToHide() <code>[signal]</code></h3>
<p>This signal is emitted just before the popup menu is hidden after it
has been displayed.
<p>See also <a href="#245441">aboutToShow</a>(), <a href="qmenudata.html#c9a23c">setItemEnabled</a>(), <a href="qmenudata.html#319c05">setItemChecked</a>(), <a href="qmenudata.html#0076cb">insertItem</a>() and <a href="qmenudata.html#001b53">removeItem</a>().
<h3 class="fn">void<a name="245441"></a>QPopupMenu::aboutToShow() <code>[signal]</code></h3>
<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>See also <a href="#d6c664">aboutToHide</a>(), <a href="qmenudata.html#c9a23c">setItemEnabled</a>(), <a href="qmenudata.html#319c05">setItemChecked</a>(), <a href="qmenudata.html#0076cb">insertItem</a>() and <a href="qmenudata.html#001b53">removeItem</a>().
<h3 class="fn">void<a name="8de478"></a>QPopupMenu::activateItemAt(intindex)</h3>
<p>Reimplemented for internal reasons; the API is not affected.
<h3 class="fn">void<a name="b224f0"></a>QPopupMenu::activated(intid) <code>[signal]</code></h3>
<p>This signal is emitted when a menu item is selected; <em>id</em> is the id
of the selected item.
<p>Normally, you will connect each menu item to a single slot using
<a href="qmenudata.html#a0155e">QMenuData::insertItem</a>(), but sometimes you will want to connect
several items to a single slot (most often if the user selects from
an array). This signal is handy in such cases.
<p>See also <a href="#4abbe8">highlighted</a>() and <a href="qmenudata.html#a0155e">QMenuData::insertItem</a>().
<h3 class="fn">void<a name="711e61"></a>QPopupMenu::closeEvent(<a href="qcloseevent.html">QCloseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#c04094">QWidget.</a>
<h3 class="fn">int<a name="fc4d48"></a>QPopupMenu::columns()const <code>[protected]</code></h3>
<p>If a popup menu does not fit on the screen, it layouts itself in
multiple columns until it fits.
<p>This functions returns in how many.
<p>See also <a href="#934139">sizeHint</a>().
<h3 class="fn">bool<a name="d48b16"></a>QPopupMenu::customWhatsThis()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#eeb880">QWidget.</a>
<h3 class="fn">void<a name="7142b1"></a>QPopupMenu::drawContents(<a href="qpainter.html">QPainter</a>*p) <code>[virtualprotected]</code></h3>
<p>Draws all menu items.
<p>Reimplemented from <a href="qframe.html#1991fc">QFrame.</a>
<h3 class="fn">void<a name="55a51e"></a>QPopupMenu::drawItem(<a href="qpainter.html">QPainter</a>*p, inttab_, QMenuItem*mi, boolact, intx, inty, intw, inth) <code>[protected]</code></h3>
<p>Draws item <em>mi</em> in the area <em>x, y, w, h,</em>
using painter <em>p.</em> The item is drawn active or inactive according
to <em>act,</em> and using the rightmost <em>tab_</em> pixels for accelerator
text.
<p>See also <a href="qstyle.html#c5672c">QStyle::drawPopupMenuItem</a>().
<h3 class="fn">int<a name="aeb921"></a>QPopupMenu::exec()</h3>
<p>Execute this popup synchronously.
<p>Similar to the above function, but the position of the
popup is not set, so you must choose an appropriate position.
The function move the popup if it is partially off-screen.
<p>More common usage is to position the popup at the current
mouse position:
<pre> exec(<a href="qcursor.html#5bce2b">QCursor::pos</a>());
</pre>
<p>or aligned to a widget:
<pre> exec(somewidget.mapToGlobal(<a href="qpoint.html">QPoint</a>(0,0)));
</pre>
<h3 class="fn">int<a name="ac4d90"></a>QPopupMenu::exec(const<a href="qpoint.html">QPoint</a>&pos, intindexAtPoint=0)</h3>
<p>Execute this popup synchronously.
<p>Opens the popup menu so that the item number <em>indexAtPoint</em> will be
at the specified <em>global</em> position <em>pos.</em> To translate a widget's
local coordinates into global coordinates, use <a href="qwidget.html#eb4b9c">QWidget::mapToGlobal</a>().
<p>The return code is the ID of the selected item in either the popup
menu or one of its submenus, or -1 if no item is selected (normally
because the user presses Escape).
<p>Note that all signals are emitted as usual. If you connect a menu
item to a slot and call the menu's exec(), you get the result both
via the signal-slot connection and in the return value of exec().
<p>Common usage is to position the popup at the current
mouse position:
<pre> exec(<a href="qcursor.html#5bce2b">QCursor::pos</a>());
</pre>
<p>or aligned to a widget:
<pre> exec(somewidget.mapToGlobal(<a href="qpoint.html">QPoint</a>(0,0)));
</pre>
<p>When positioning a popup with exec() or <a href="#0d7b5f">popup</a>(), keep in mind that
you cannot rely on the popup menu's current <a href="qwidget.html#50b75e">size</a>(). For performance
reasons, the popup adapts its size only when actually needed. So in
many cases, the size before and after the show is
different. Instead, use <a href="#934139">sizeHint</a>(). It calculates the proper size
depending on the menu's current contents.
<p>See also <a href="#0d7b5f">popup</a>() and <a href="#934139">sizeHint</a>().
<h3 class="fn">void<a name="912b79"></a>QPopupMenu::focusInEvent(<a href="qfocusevent.html">QFocusEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#21a4b8">QWidget.</a>
<h3 class="fn">bool<a name="55b0a0"></a>QPopupMenu::focusNextPrevChild(boolnext) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#8d74a1">QWidget.</a>
<h3 class="fn">void<a name="914706"></a>QPopupMenu::focusOutEvent(<a href="qfocusevent.html">QFocusEvent</a>*) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#de664a">QWidget.</a>
<h3 class="fn">void<a name="2d90fa"></a>QPopupMenu::hide() <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#410481">QWidget.</a>
<h3 class="fn">void<a name="4abbe8"></a>QPopupMenu::highlighted(intid) <code>[signal]</code></h3>
<p>This signal is emitted when a menu item is highlighted; <em>id</em> is the
id of the highlighted item.
<p>Normally, you will connect each menu item to a single slot using
<a href="qmenudata.html#a0155e">QMenuData::insertItem</a>(), but sometimes you will want to connect
several items to a single slot (most often if the user selects from
an array). This signal is handy in such cases.
<p>See also <a href="#b224f0">activated</a>() and <a href="qmenudata.html#a0155e">QMenuData::insertItem</a>().
<h3 class="fn">int<a name="6776f6"></a>QPopupMenu::idAt(const<a href="qpoint.html">QPoint</a>&pos)const</h3>
<p>Return the id of the item at <em>pos,</em> or -1 if there is no item
there, or if it is a separator item.
<p>Examples:
<a href="scrollview-scrollview-cpp.html#idAt">scrollview/scrollview.cpp</a>
<h3 class="fn">int<a name="deaaee"></a>QPopupMenu::idAt(intindex)const</h3>
<p>Returns the identifier of the menu item at position <em>index</em> in the internal
list, or -1 if <em>index</em> is out of range.
<p>See also <a href="qmenudata.html#505058">QMenuData::setId</a>() and <a href="qmenudata.html#49862d">QMenuData::indexOf</a>().
<h3 class="fn">int<a name="27032b"></a>QPopupMenu::insertTearOffHandle(intid=-1, intindex=-1)</h3>
<p>Inserts a tear-off handle into the menu. A tear-off handle is a
special menu item, that - when selected - creates a copy of the
menu. This "torn off" copy lives in a separate window. It contains
the same choices as the original menu, with the exception of the
tear-off handle.
<p>You may also want to set a proper window title for the tear-off menu
with <a href="qwidget.html#d6a291">setCaption</a>().
<p>The handle item is assigned the identifier <em>id</em> or an automatically
generated identifier if <em>id</em> is < 0. The generated identifiers
(negative integers) are guaranteed to be unique within the entire
application.
<p>The <em>index</em> specifies the position in the menu. The tear-off
handle is appended at the end of the list if <em>index</em> is negative.
<p>Examples:
<a href="menu-menu-cpp.html#insertTearOffHandle">menu/menu.cpp</a>
<h3 class="fn">bool<a name="0ab7fe"></a>QPopupMenu::isCheckable()const</h3>
<p>Returns whether display of check marks by the menu items is enabled.
<p>See also <a href="#672d77">setCheckable</a>() and <a href="qmenudata.html#319c05">QMenuData::setItemChecked</a>().
<h3 class="fn">int<a name="043d7b"></a>QPopupMenu::itemHeight(QMenuItem*mi)const <code>[protected]</code></h3>
<p>Calculates the height in pixels of the item <em>mi.</em>
<h3 class="fn">int<a name="0e5c68"></a>QPopupMenu::itemHeight(introw)const <code>[protected]</code></h3>
<p>Calculates the height in pixels of the item in row <em>row.</em>
<h3 class="fn">void<a name="eef3e4"></a>QPopupMenu::keyPressEvent(<a href="qkeyevent.html">QKeyEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#0a4482">QWidget.</a>
<h3 class="fn">void<a name="113f0f"></a>QPopupMenu::mouseMoveEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#a51d92">QWidget.</a>
<h3 class="fn">void<a name="10529b"></a>QPopupMenu::mousePressEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#2ecc04">QWidget.</a>
<h3 class="fn">void<a name="565164"></a>QPopupMenu::mouseReleaseEvent(<a href="qmouseevent.html">QMouseEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#9aa77f">QWidget.</a>
<h3 class="fn">void<a name="46c526"></a>QPopupMenu::paintEvent(<a href="qpaintevent.html">QPaintEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#e3d821">QWidget.</a>
<h3 class="fn">void<a name="0d7b5f"></a>QPopupMenu::popup(const<a href="qpoint.html">QPoint</a>&pos, intindexAtPoint=0)</h3>
<p>Opens the popup menu so that the item number <em>indexAtPoint</em> will be
at the specified <em>global</em> position <em>pos.</em> To translate a widget's
local coordinates into global coordinates, use <a href="qwidget.html#eb4b9c">QWidget::mapToGlobal</a>().
<p>When positioning a popup with <a href="#ac4d90">exec</a>() or popup(), keep in mind that
you cannot rely on the popup menu's current <a href="qwidget.html#50b75e">size</a>(). For performance
reasons, the popup adapts its size only when actually needed. So in
many cases, the size before and after the show is
different. Instead, use <a href="#934139">sizeHint</a>(). It calculates the proper size
depending on the menu's current contents.
<p>Examples:
<a href="qtimage-qtimage-cpp.html#popup">qtimage/qtimage.cpp</a>
<h3 class="fn">void<a name="2ba062"></a>QPopupMenu::setActiveItem(inti) <code>[virtual]</code></h3>
<p>Sets the currently active item to <em>i</em> and repaints as necessary.
<h3 class="fn">void<a name="672d77"></a>QPopupMenu::setCheckable(boolenable) <code>[virtual]</code></h3>
<p>Enables or disables display of check marks by the menu items.
<p>Notice that checking is always enabled when in windows-style.
<p>See also <a href="#0ab7fe">isCheckable</a>() and <a href="qmenudata.html#319c05">QMenuData::setItemChecked</a>().
<p>Examples:
<a href="menu-menu-cpp.html#setCheckable">menu/menu.cpp</a>
<a href="progress-progress-cpp.html#setCheckable">progress/progress.cpp</a>
<a href="scrollview-scrollview-cpp.html#setCheckable">scrollview/scrollview.cpp</a>
<h3 class="fn">void<a name="3e68bb"></a>QPopupMenu::setFont(const<a href="qfont.html">QFont</a>&font) <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#c52788">QWidget.</a>
<h3 class="fn">void<a name="50a0ef"></a>QPopupMenu::show() <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#200ee5">QWidget.</a>
<h3 class="fn"><a href="qsize.html">QSize</a><a name="934139"></a>QPopupMenu::sizeHint()const <code>[virtual]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#4511d1">QWidget.</a>
<h3 class="fn">void<a name="2ac016"></a>QPopupMenu::styleChange(<a href="qstyle.html">QStyle</a>&old) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qwidget.html#5e2e23">QWidget.</a>
<h3 class="fn">void<a name="a000a2"></a>QPopupMenu::timerEvent(<a href="qtimerevent.html">QTimerEvent</a>*e) <code>[virtualprotected]</code></h3>
<p>Reimplemented for internal reasons; the API is not affected.
<p>Reimplemented from <a href="qobject.html#7fd5bf">QObject.</a>
<h3 class="fn">void<a name="8732b1"></a>QPopupMenu::updateItem(intid) <code>[virtual]</code></h3>
<p>Updates the item with identity <em>id.</em>
<p>Reimplemented from <a href="qmenudata.html#f532d3">QMenuData.</a>
<h3 class="fn">void<a name="ad85f5"></a>QPopupMenu::activatedRedirect(intid) <code>[signal]</code></h3>
<p>For internal use only.
<h3 class="fn">void<a name="916dda"></a>QPopupMenu::highlightedRedirect(intid) <code>[signal]</code></h3>
<p>For internal use only.
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|