1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qmenubar.cpp:75 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QMenuBar Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QMenuBar Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QMenuBar class provides a horizontal menu bar.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qmenubar-h.html">qmenubar.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qframe.html">QFrame</a> and <a href="qmenudata.html">QMenuData</a>.
|
---|
38 | <p><a href="qmenubar-members.html">List of all member functions.</a>
|
---|
39 | <h2>Public Members</h2>
|
---|
40 | <ul>
|
---|
41 | <li class=fn><a href="#QMenuBar"><b>QMenuBar</b></a> ( QWidget * parent = 0, const char * name = 0 )</li>
|
---|
42 | <li class=fn><a href="#~QMenuBar"><b>~QMenuBar</b></a> ()</li>
|
---|
43 | <li class=fn>virtual void <a href="#show"><b>show</b></a> ()</li>
|
---|
44 | <li class=fn>virtual void <a href="#hide"><b>hide</b></a> ()</li>
|
---|
45 | <li class=fn>virtual int <a href="#heightForWidth"><b>heightForWidth</b></a> ( int max_width ) const</li>
|
---|
46 | <li class=fn>enum <a href="#Separator-enum"><b>Separator</b></a> { Never = 0, InWindowsStyle = 1 }</li>
|
---|
47 | <li class=fn>Separator separator () const <em>(obsolete)</em></li>
|
---|
48 | <li class=fn>virtual void setSeparator ( Separator when ) <em>(obsolete)</em></li>
|
---|
49 | <li class=fn>void <a href="#setDefaultUp"><b>setDefaultUp</b></a> ( bool )</li>
|
---|
50 | <li class=fn>bool <a href="#isDefaultUp"><b>isDefaultUp</b></a> () const</li>
|
---|
51 | </ul>
|
---|
52 | <h2>Signals</h2>
|
---|
53 | <ul>
|
---|
54 | <li class=fn>void <a href="#activated"><b>activated</b></a> ( int id )</li>
|
---|
55 | <li class=fn>void <a href="#highlighted"><b>highlighted</b></a> ( int id )</li>
|
---|
56 | </ul>
|
---|
57 | <h2>Important Inherited Members</h2>
|
---|
58 | <ul>
|
---|
59 | <li class=fn>int <a href="#insertItem"><b>insertItem</b></a> ( const QString & text, const QObject * receiver, const char * member, const QKeySequence & accel = 0, int id = -1, int index = -1 )</li>
|
---|
60 | <li class=fn>int <a href="#insertItem-2"><b>insertItem</b></a> ( const QIconSet & icon, const QString & text, const QObject * receiver, const char * member, const QKeySequence & accel = 0, int id = -1, int index = -1 )</li>
|
---|
61 | <li class=fn>int <a href="#insertItem-3"><b>insertItem</b></a> ( const QPixmap & pixmap, const QObject * receiver, const char * member, const QKeySequence & accel = 0, int id = -1, int index = -1 )</li>
|
---|
62 | <li class=fn>int <a href="#insertItem-4"><b>insertItem</b></a> ( const QIconSet & icon, const QPixmap & pixmap, const QObject * receiver, const char * member, const QKeySequence & accel = 0, int id = -1, int index = -1 )</li>
|
---|
63 | <li class=fn>int <a href="#insertItem-5"><b>insertItem</b></a> ( const QString & text, int id = -1, int index = -1 )</li>
|
---|
64 | <li class=fn>int <a href="#insertItem-6"><b>insertItem</b></a> ( const QIconSet & icon, const QString & text, int id = -1, int index = -1 )</li>
|
---|
65 | <li class=fn>int <a href="#insertItem-7"><b>insertItem</b></a> ( const QString & text, QPopupMenu * popup, int id = -1, int index = -1 )</li>
|
---|
66 | <li class=fn>int <a href="#insertItem-8"><b>insertItem</b></a> ( const QIconSet & icon, const QString & text, QPopupMenu * popup, int id = -1, int index = -1 )</li>
|
---|
67 | <li class=fn>int <a href="#insertItem-9"><b>insertItem</b></a> ( const QPixmap & pixmap, int id = -1, int index = -1 )</li>
|
---|
68 | <li class=fn>int <a href="#insertItem-a"><b>insertItem</b></a> ( const QIconSet & icon, const QPixmap & pixmap, int id = -1, int index = -1 )</li>
|
---|
69 | <li class=fn>int <a href="#insertItem-b"><b>insertItem</b></a> ( const QPixmap & pixmap, QPopupMenu * popup, int id = -1, int index = -1 )</li>
|
---|
70 | <li class=fn>int <a href="#insertItem-c"><b>insertItem</b></a> ( const QIconSet & icon, const QPixmap & pixmap, QPopupMenu * popup, int id = -1, int index = -1 )</li>
|
---|
71 | <li class=fn>int <a href="#insertItem-d"><b>insertItem</b></a> ( QWidget * widget, int id = -1, int index = -1 )</li>
|
---|
72 | <li class=fn>int <a href="#insertItem-e"><b>insertItem</b></a> ( const QIconSet & icon, QCustomMenuItem * custom, int id = -1, int index = -1 )</li>
|
---|
73 | <li class=fn>int <a href="#insertItem-f"><b>insertItem</b></a> ( QCustomMenuItem * custom, int id = -1, int index = -1 )</li>
|
---|
74 | <li class=fn>int <a href="#insertSeparator"><b>insertSeparator</b></a> ( int index = -1 )</li>
|
---|
75 | <li class=fn>void <a href="#removeItem"><b>removeItem</b></a> ( int id )</li>
|
---|
76 | <li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
|
---|
77 | <li class=fn>bool <a href="#isItemEnabled"><b>isItemEnabled</b></a> ( int id ) const</li>
|
---|
78 | <li class=fn>void <a href="#setItemEnabled"><b>setItemEnabled</b></a> ( int id, bool enable )</li>
|
---|
79 | <li class=fn>bool <a href="#isItemVisible"><b>isItemVisible</b></a> ( int id ) const</li>
|
---|
80 | <li class=fn>void <a href="#setItemVisible"><b>setItemVisible</b></a> ( int id, bool visible )</li>
|
---|
81 | </ul>
|
---|
82 | <h2>Properties</h2>
|
---|
83 | <ul>
|
---|
84 | <li class=fn>bool <a href="#defaultUp-prop"><b>defaultUp</b></a> - the popup orientation</li>
|
---|
85 | <li class=fn>Separator separator - in which cases a menubar sparator is drawn <em>(obsolete)</em></li>
|
---|
86 | </ul>
|
---|
87 | <h2>Protected Members</h2>
|
---|
88 | <ul>
|
---|
89 | <li class=fn>virtual void <a href="#drawContents"><b>drawContents</b></a> ( QPainter * p )</li>
|
---|
90 | <li class=fn>virtual void <a href="#menuContentsChanged"><b>menuContentsChanged</b></a> ()</li>
|
---|
91 | <li class=fn>virtual void <a href="#menuStateChanged"><b>menuStateChanged</b></a> ()</li>
|
---|
92 | </ul>
|
---|
93 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
94 |
|
---|
95 |
|
---|
96 | The QMenuBar class provides a horizontal menu bar.
|
---|
97 | <p>
|
---|
98 |
|
---|
99 | <p> A menu bar consists of a list of pull-down menu items. You add
|
---|
100 | menu items with <a href="qmenudata.html#insertItem">insertItem()</a>. For example, asuming that <tt>menubar</tt> is a
|
---|
101 | pointer to a QMenuBar and <tt>filemenu</tt> is a pointer to a
|
---|
102 | <a href="qpopupmenu.html">QPopupMenu</a>, the following statement inserts the menu into the menu
|
---|
103 | bar:
|
---|
104 | <pre>
|
---|
105 | menubar->insertItem( "&File", filemenu );
|
---|
106 | </pre>
|
---|
107 |
|
---|
108 | The ampersand in the menu item's text sets Alt+F as a shortcut for
|
---|
109 | this menu. (You can use "&&" to get a real ampersand in the menu
|
---|
110 | bar.)
|
---|
111 | <p> Items are either enabled or disabled. You toggle their state with
|
---|
112 | <a href="qmenudata.html#setItemEnabled">setItemEnabled</a>().
|
---|
113 | <p> There is no need to lay out a menu bar. It automatically sets its
|
---|
114 | own geometry to the top of the parent widget and changes it
|
---|
115 | appropriately whenever the parent is resized.
|
---|
116 | <p>
|
---|
117 | <p> Example of creating a menu bar with menu items (from <a href="menu-example.html">menu/menu.cpp</a>):
|
---|
118 |
|
---|
119 |
|
---|
120 | <pre> <a href="qpopupmenu.html">QPopupMenu</a> *file = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
|
---|
121 | </pre><pre> file-><a href="qmenudata.html#insertItem">insertItem</a>( p1, "&Open", this, SLOT(open()), CTRL+Key_O );
|
---|
122 | file-><a href="qmenudata.html#insertItem">insertItem</a>( p2, "&New", this, SLOT(news()), CTRL+Key_N );
|
---|
123 | </pre><pre> menu = new QMenuBar( this );
|
---|
124 | </pre><pre> menu-><a href="qmenudata.html#insertItem">insertItem</a>( "&File", file );
|
---|
125 | </pre>
|
---|
126 | <p> In most main window style applications you would use the menuBar()
|
---|
127 | provided in <a href="qmainwindow.html">QMainWindow</a>, adding <a href="qpopupmenu.html">QPopupMenu</a>s to the menu bar
|
---|
128 | and adding <a href="qaction.html">QAction</a>s to the popup menus.
|
---|
129 | <p> Example (from <a href="qaction-application-example.html">action/application.cpp</a>):
|
---|
130 |
|
---|
131 |
|
---|
132 | <pre> <a href="qpopupmenu.html">QPopupMenu</a> * file = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
|
---|
133 | <a href="qmainwindow.html#menuBar">menuBar</a>()->insertItem( "&File", file );
|
---|
134 | fileNewAction-><a href="qaction.html#addTo">addTo</a>( file );
|
---|
135 | </pre>
|
---|
136 | <p> Menu items can have text and pixmaps (or iconsets), see the
|
---|
137 | various <a href="qmenudata.html#insertItem">insertItem()</a>
|
---|
138 | overloads, as well as separators, see <a href="qmenudata.html#insertSeparator">insertSeparator()</a>. You can
|
---|
139 | also add custom menu items that are derived from
|
---|
140 | <a href="qcustommenuitem.html">QCustomMenuItem</a>.
|
---|
141 | <p> Menu items may be removed with <a href="qmenudata.html#removeItem">removeItem</a>() and enabled or
|
---|
142 | disabled with <a href="qmenudata.html#setItemEnabled">setItemEnabled()</a>.
|
---|
143 | <p> <img src=qmenubar-m.png> <img src=qmenubar-w.png>
|
---|
144 | <p> <h3> QMenuBar on Qt/Mac
|
---|
145 | </h3>
|
---|
146 | <a name="1"></a><p> QMenuBar on Qt/Mac is a wrapper for using the system-wide menubar.
|
---|
147 | If you have multiple menubars in one dialog the outermost menubar
|
---|
148 | (normally inside a widget with <a href="qt.html#WidgetFlags">widget flag</a> <a href="qt.html#WidgetFlags-enum">WType_TopLevel</a>) will
|
---|
149 | be used for the system-wide menubar.
|
---|
150 | <p> Note that arbitrary Qt widgets <em>cannot</em> be inserted into a
|
---|
151 | QMenuBar on the Mac because Qt uses Mac's native menus which don't
|
---|
152 | support this functionality. This limitation does not apply to
|
---|
153 | stand-alone QPopupMenus.
|
---|
154 | <p> Qt/Mac also provides a menubar merging feature to make QMenuBar
|
---|
155 | conform more closely to accepted Mac OS X menubar layout. The
|
---|
156 | merging functionality is based on string matching the title of a
|
---|
157 | <a href="qpopupmenu.html">QPopupMenu</a> entry. These strings are translated (using
|
---|
158 | <a href="qobject.html#tr">QObject::tr</a>()) in the "QMenuBar" context. If an entry is moved its
|
---|
159 | slots will still fire as if it was in the original place. The
|
---|
160 | table below outlines the strings looked for and where the entry is
|
---|
161 | placed if matched:
|
---|
162 | <p> <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
163 | <tr bgcolor="#a2c511"> <th valign="top">String matches <th valign="top">Placement <th valign="top">Notes
|
---|
164 | <tr bgcolor="#f0f0f0"> <td valign="top">about.*
|
---|
165 | <td valign="top">Application Menu | About <application name>
|
---|
166 | <td valign="top">If this entry is not found no About item will appear in
|
---|
167 | the Application Menu
|
---|
168 | <tr bgcolor="#d0d0d0"> <td valign="top">config, options, setup, settings or preferences
|
---|
169 | <td valign="top">Application Menu | Preferences
|
---|
170 | <td valign="top">If this entry is not found the Settings item will be disabled
|
---|
171 | <tr bgcolor="#f0f0f0"> <td valign="top">quit or exit
|
---|
172 | <td valign="top">Application Menu | Quit <application name>
|
---|
173 | <td valign="top">If this entry is not found a default Quit item will be
|
---|
174 | created to call <a href="qapplication.html#quit">QApplication::quit</a>()
|
---|
175 | </table></center>
|
---|
176 | <p> <a href="menu-example.html">menu/menu.cpp</a> is an example of
|
---|
177 | QMenuBar and <a href="qpopupmenu.html">QPopupMenu</a> use.
|
---|
178 | <p> <p>See also <a href="qpopupmenu.html">QPopupMenu</a>, <a href="qaccel.html">QAccel</a>, <a href="qaction.html">QAction</a>, <a href="http://developer.apple.com/techpubs/macosx/Carbon/HumanInterfaceToolbox/Aqua/aqua.html">Aqua Style Guidelines</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Menu Bar</a>, and <a href="application.html">Main Window and Related Classes</a>.
|
---|
179 |
|
---|
180 | <hr><h2>Member Type Documentation</h2>
|
---|
181 | <h3 class=fn><a name="Separator-enum"></a>QMenuBar::Separator</h3>
|
---|
182 |
|
---|
183 | <p> This enum type is used to decide whether QMenuBar should draw a
|
---|
184 | separator line at its bottom.
|
---|
185 | <ul>
|
---|
186 | <li><tt>QMenuBar::Never</tt> - In many applications there is already a separator,
|
---|
187 | and having two looks wrong.
|
---|
188 | <li><tt>QMenuBar::InWindowsStyle</tt> - In some other applications a separator looks
|
---|
189 | good in Windows style, but nowhere else.
|
---|
190 | </ul>
|
---|
191 | <hr><h2>Member Function Documentation</h2>
|
---|
192 | <h3 class=fn><a name="QMenuBar"></a>QMenuBar::QMenuBar ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0 )
|
---|
193 | </h3>
|
---|
194 | Constructs a menu bar called <em>name</em> with parent <em>parent</em>.
|
---|
195 |
|
---|
196 | <h3 class=fn><a name="~QMenuBar"></a>QMenuBar::~QMenuBar ()
|
---|
197 | </h3>
|
---|
198 | Destroys the menu bar.
|
---|
199 |
|
---|
200 | <h3 class=fn>void <a name="activated"></a>QMenuBar::activated ( int id )<tt> [signal]</tt>
|
---|
201 | </h3>
|
---|
202 |
|
---|
203 | <p> This signal is emitted when a menu item is selected; <em>id</em> is the
|
---|
204 | id of the selected item.
|
---|
205 | <p> Normally you will connect each menu item to a single slot using
|
---|
206 | <a href="qmenudata.html#insertItem">QMenuData::insertItem</a>(), but sometimes you will want to connect
|
---|
207 | several items to a single slot (most often if the user selects
|
---|
208 | from an array). This signal is useful in such cases.
|
---|
209 | <p> <p>See also <a href="#highlighted">highlighted</a>() and <a href="qmenudata.html#insertItem">QMenuData::insertItem</a>().
|
---|
210 |
|
---|
211 | <p>Example: <a href="progress-example.html#x67">progress/progress.cpp</a>.
|
---|
212 | <h3 class=fn>void <a name="clear"></a>QMenuData::clear ()
|
---|
213 | </h3>
|
---|
214 | Removes all menu items.
|
---|
215 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>() and <a href="qmenudata.html#removeItemAt">removeItemAt</a>().
|
---|
216 |
|
---|
217 | <p>Examples: <a href="mdi-example.html#x2029">mdi/application.cpp</a> and <a href="qwerty-example.html#x370">qwerty/qwerty.cpp</a>.
|
---|
218 | <h3 class=fn>void <a name="drawContents"></a>QMenuBar::drawContents ( <a href="qpainter.html">QPainter</a> * p )<tt> [virtual protected]</tt>
|
---|
219 | </h3>
|
---|
220 | Called from <a href="qframe.html#paintEvent">QFrame::paintEvent</a>(). Draws the menu bar contents
|
---|
221 | using painter <em>p</em>.
|
---|
222 |
|
---|
223 | <p>Reimplemented from <a href="qframe.html#drawContents">QFrame</a>.
|
---|
224 | <h3 class=fn>int <a name="heightForWidth"></a>QMenuBar::heightForWidth ( int max_width ) const<tt> [virtual]</tt>
|
---|
225 | </h3>
|
---|
226 | Returns the height that the menu would resize itself to if its
|
---|
227 | parent (and hence itself) resized to the given <em>max_width</em>. This
|
---|
228 | can be useful for simple layout tasks in which the height of the
|
---|
229 | menu bar is needed after items have been inserted. See <a href="showimg-example.html">showimg/showimg.cpp</a> for an example of the usage.
|
---|
230 |
|
---|
231 | <p>Example: <a href="showimg-example.html#x1325">showimg/showimg.cpp</a>.
|
---|
232 | <p>Reimplemented from <a href="qwidget.html#heightForWidth">QWidget</a>.
|
---|
233 | <h3 class=fn>void <a name="hide"></a>QMenuBar::hide ()<tt> [virtual]</tt>
|
---|
234 | </h3>
|
---|
235 | Reimplements <a href="qwidget.html#hide">QWidget::hide</a>() in order to deselect any selected
|
---|
236 | item, and calls setUpLayout() for the main window.
|
---|
237 |
|
---|
238 | <p>Example: <a href="grapher-nsplugin-example.html#x2745">grapher/grapher.cpp</a>.
|
---|
239 | <p>Reimplemented from <a href="qwidget.html#hide">QWidget</a>.
|
---|
240 | <h3 class=fn>void <a name="highlighted"></a>QMenuBar::highlighted ( int id )<tt> [signal]</tt>
|
---|
241 | </h3>
|
---|
242 |
|
---|
243 | <p> This signal is emitted when a menu item is highlighted; <em>id</em> is
|
---|
244 | the id of the highlighted item.
|
---|
245 | <p> Normally, you will connect each menu item to a single slot using
|
---|
246 | <a href="qmenudata.html#insertItem">QMenuData::insertItem</a>(), but sometimes you will want to connect
|
---|
247 | several items to a single slot (most often if the user selects
|
---|
248 | from an array). This signal is useful in such cases.
|
---|
249 | <p> <p>See also <a href="#activated">activated</a>() and <a href="qmenudata.html#insertItem">QMenuData::insertItem</a>().
|
---|
250 |
|
---|
251 | <h3 class=fn>int <a name="insertItem"></a>QMenuData::insertItem ( const <a href="qstring.html">QString</a> & text, const <a href="qobject.html">QObject</a> * receiver, const char * member, const <a href="qkeysequence.html">QKeySequence</a> & accel = 0, int id = -1, int index = -1 )
|
---|
252 | </h3>
|
---|
253 | The family of <a href="qmenudata.html#insertItem">insertItem</a>() functions inserts menu items into a
|
---|
254 | popup menu or a menu bar.
|
---|
255 | <p> A menu item is usually either a text string or a pixmap, both with
|
---|
256 | an optional icon or keyboard accelerator. For special cases it is
|
---|
257 | also possible to insert custom items (see <a href="qcustommenuitem.html">QCustomMenuItem</a>) or
|
---|
258 | even widgets into popup menus.
|
---|
259 | <p> Some insertItem() members take a popup menu as an additional
|
---|
260 | argument. Use this to insert submenus into existing menus or
|
---|
261 | pulldown menus into a menu bar.
|
---|
262 | <p> The number of insert functions may look confusing, but they are
|
---|
263 | actually quite simple to use.
|
---|
264 | <p> This default version inserts a menu item with the text <em>text</em>,
|
---|
265 | the accelerator key <em>accel</em>, an id and an optional index and
|
---|
266 | connects it to the slot <em>member</em> in the object <em>receiver</em>.
|
---|
267 | <p> Example:
|
---|
268 | <pre>
|
---|
269 | QMenuBar *mainMenu = new QMenuBar;
|
---|
270 | <a href="qpopupmenu.html">QPopupMenu</a> *fileMenu = new <a href="qpopupmenu.html">QPopupMenu</a>;
|
---|
271 | fileMenu-><a href="qmenudata.html#insertItem">insertItem</a>( "New", myView, SLOT(newFile()), CTRL+Key_N );
|
---|
272 | fileMenu-><a href="qmenudata.html#insertItem">insertItem</a>( "Open", myView, SLOT(open()), CTRL+Key_O );
|
---|
273 | mainMenu-><a href="qmenudata.html#insertItem">insertItem</a>( "File", fileMenu );
|
---|
274 | </pre>
|
---|
275 |
|
---|
276 | <p> Not all insert functions take an object/slot parameter or an
|
---|
277 | accelerator key. Use <a href="qmenudata.html#connectItem">connectItem</a>() and <a href="qmenudata.html#setAccel">setAccel</a>() on those items.
|
---|
278 | <p> If you need to translate accelerators, use <a href="qobject.html#tr">tr</a>() with the text and
|
---|
279 | accelerator. (For translations use a string <a href="qkeysequence.html">key
|
---|
280 | sequence</a>.):
|
---|
281 | <pre>
|
---|
282 | fileMenu->insertItem( <a href="qobject.html#tr">tr</a>("Open"), myView, SLOT(open()),
|
---|
283 | <a href="qobject.html#tr">tr</a>("Ctrl+O") );
|
---|
284 | </pre>
|
---|
285 |
|
---|
286 | <p> In the example above, pressing Ctrl+O or selecting "Open" from the
|
---|
287 | menu activates the myView->open() function.
|
---|
288 | <p> Some insert functions take a <a href="qiconset.html">QIconSet</a> parameter to specify the
|
---|
289 | little menu item icon. Note that you can always pass a <a href="qpixmap.html">QPixmap</a>
|
---|
290 | object instead.
|
---|
291 | <p> The <em>id</em> specifies the identification number associated with the
|
---|
292 | menu item. Note that only positive values are valid, as a negative
|
---|
293 | value will make Qt select a unique id for the item.
|
---|
294 | <p> The <em>index</em> specifies the position in the menu. The menu item is
|
---|
295 | appended at the end of the list if <em>index</em> is negative.
|
---|
296 | <p> Note that keyboard accelerators in Qt are not application-global,
|
---|
297 | instead they are bound to a certain top-level window. For example,
|
---|
298 | accelerators in <a href="qpopupmenu.html">QPopupMenu</a> items only work for menus that are
|
---|
299 | associated with a certain window. This is true for popup menus
|
---|
300 | that live in a menu bar since their accelerators will then be
|
---|
301 | installed in the menu bar itself. This also applies to stand-alone
|
---|
302 | popup menus that have a top-level widget in their <a href="qwidget.html#parentWidget">parentWidget</a>()
|
---|
303 | chain. The menu will then install its accelerator object on that
|
---|
304 | top-level widget. For all other cases use an independent <a href="qaccel.html">QAccel</a>
|
---|
305 | object.
|
---|
306 | <p> <b>Warning:</b> Be careful when passing a literal 0 to <a href="qmenudata.html#insertItem">insertItem</a>()
|
---|
307 | because some C++ compilers choose the wrong overloaded function.
|
---|
308 | Cast the 0 to what you mean, e.g. <tt>(QObject*)0</tt>.
|
---|
309 | <p> <b>Warning:</b> On Mac OS X, items that connect to a slot that are inserted into a
|
---|
310 | menubar will not function as we use the native menubar that knows nothing
|
---|
311 | about signals or slots. Instead insert the items into a popup menu and
|
---|
312 | insert the popup menu into the menubar. This may be fixed in a future Qt
|
---|
313 | version.
|
---|
314 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
315 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), <a href="qmenudata.html#connectItem">connectItem</a>(), <a href="qaccel.html">QAccel</a>, and <a href="qnamespace-h.html">qnamespace.h</a>.
|
---|
316 |
|
---|
317 | <p>Examples: <a href="addressbook-example.html#x569">addressbook/mainwindow.cpp</a>, <a href="canvas-example.html#x2936">canvas/canvas.cpp</a>, <a href="menu-example.html#x1869">menu/menu.cpp</a>, <a href="qwerty-example.html#x371">qwerty/qwerty.cpp</a>, <a href="scrollview-example.html#x634">scrollview/scrollview.cpp</a>, <a href="showimg-example.html#x1327">showimg/showimg.cpp</a>, and <a href="sound-example.html#x2810">sound/sound.cpp</a>.
|
---|
318 | <h3 class=fn>int <a name="insertItem-2"></a>QMenuData::insertItem ( const <a href="qiconset.html">QIconSet</a> & icon, const <a href="qstring.html">QString</a> & text, const <a href="qobject.html">QObject</a> * receiver, const char * member, const <a href="qkeysequence.html">QKeySequence</a> & accel = 0, int id = -1, int index = -1 )
|
---|
319 | </h3>
|
---|
320 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
321 | <p> Inserts a menu item with icon <em>icon</em>, text <em>text</em>, accelerator
|
---|
322 | <em>accel</em>, optional id <em>id</em>, and optional <em>index</em> position. The
|
---|
323 | menu item is connected it to the <em>receiver</em>'s <em>member</em> slot. The
|
---|
324 | icon will be displayed to the left of the text in the item.
|
---|
325 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
326 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), <a href="qmenudata.html#connectItem">connectItem</a>(), <a href="qaccel.html">QAccel</a>, and <a href="qnamespace-h.html">qnamespace.h</a>.
|
---|
327 |
|
---|
328 | <h3 class=fn>int <a name="insertItem-3"></a>QMenuData::insertItem ( const <a href="qpixmap.html">QPixmap</a> & pixmap, const <a href="qobject.html">QObject</a> * receiver, const char * member, const <a href="qkeysequence.html">QKeySequence</a> & accel = 0, int id = -1, int index = -1 )
|
---|
329 | </h3>
|
---|
330 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
331 | <p> Inserts a menu item with pixmap <em>pixmap</em>, accelerator <em>accel</em>,
|
---|
332 | optional id <em>id</em>, and optional <em>index</em> position. The menu item
|
---|
333 | is connected it to the <em>receiver</em>'s <em>member</em> slot. The icon will
|
---|
334 | be displayed to the left of the text in the item.
|
---|
335 | <p> To look best when being highlighted as a menu item, the pixmap
|
---|
336 | should provide a mask (see <a href="qpixmap.html#mask">QPixmap::mask</a>()).
|
---|
337 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
338 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), and <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
339 |
|
---|
340 | <h3 class=fn>int <a name="insertItem-4"></a>QMenuData::insertItem ( const <a href="qiconset.html">QIconSet</a> & icon, const <a href="qpixmap.html">QPixmap</a> & pixmap, const <a href="qobject.html">QObject</a> * receiver, const char * member, const <a href="qkeysequence.html">QKeySequence</a> & accel = 0, int id = -1, int index = -1 )
|
---|
341 | </h3>
|
---|
342 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
343 | <p> Inserts a menu item with icon <em>icon</em>, pixmap <em>pixmap</em>,
|
---|
344 | accelerator <em>accel</em>, optional id <em>id</em>, and optional <em>index</em>
|
---|
345 | position. The icon will be displayed to the left of the pixmap in
|
---|
346 | the item. The item is connected to the <em>member</em> slot in the <em>receiver</em> object.
|
---|
347 | <p> To look best when being highlighted as a menu item, the pixmap
|
---|
348 | should provide a mask (see <a href="qpixmap.html#mask">QPixmap::mask</a>()).
|
---|
349 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
350 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), <a href="qmenudata.html#connectItem">connectItem</a>(), <a href="qaccel.html">QAccel</a>, and <a href="qnamespace-h.html">qnamespace.h</a>.
|
---|
351 |
|
---|
352 | <h3 class=fn>int <a name="insertItem-5"></a>QMenuData::insertItem ( const <a href="qstring.html">QString</a> & text, int id = -1, int index = -1 )
|
---|
353 | </h3>
|
---|
354 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
355 | <p> Inserts a menu item with text <em>text</em>, optional id <em>id</em>, and
|
---|
356 | optional <em>index</em> position.
|
---|
357 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
358 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), and <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
359 |
|
---|
360 | <h3 class=fn>int <a name="insertItem-6"></a>QMenuData::insertItem ( const <a href="qiconset.html">QIconSet</a> & icon, const <a href="qstring.html">QString</a> & text, int id = -1, int index = -1 )
|
---|
361 | </h3>
|
---|
362 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
363 | <p> Inserts a menu item with icon <em>icon</em>, text <em>text</em>, optional id
|
---|
364 | <em>id</em>, and optional <em>index</em> position. The icon will be displayed
|
---|
365 | to the left of the text in the item.
|
---|
366 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
367 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), and <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
368 |
|
---|
369 | <h3 class=fn>int <a name="insertItem-7"></a>QMenuData::insertItem ( const <a href="qstring.html">QString</a> & text, <a href="qpopupmenu.html">QPopupMenu</a> * popup, int id = -1, int index = -1 )
|
---|
370 | </h3>
|
---|
371 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
372 | <p> Inserts a menu item with text <em>text</em>, submenu <em>popup</em>, optional
|
---|
373 | id <em>id</em>, and optional <em>index</em> position.
|
---|
374 | <p> The <em>popup</em> must be deleted by the programmer or by its parent
|
---|
375 | widget. It is not deleted when this menu item is removed or when
|
---|
376 | the menu is deleted.
|
---|
377 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
378 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), and <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
379 |
|
---|
380 | <h3 class=fn>int <a name="insertItem-8"></a>QMenuData::insertItem ( const <a href="qiconset.html">QIconSet</a> & icon, const <a href="qstring.html">QString</a> & text, <a href="qpopupmenu.html">QPopupMenu</a> * popup, int id = -1, int index = -1 )
|
---|
381 | </h3>
|
---|
382 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
383 | <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
|
---|
384 | will be displayed to the left of the text in the item.
|
---|
385 | <p> The <em>popup</em> must be deleted by the programmer or by its parent
|
---|
386 | widget. It is not deleted when this menu item is removed or when
|
---|
387 | the menu is deleted.
|
---|
388 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
389 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), and <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
390 |
|
---|
391 | <h3 class=fn>int <a name="insertItem-9"></a>QMenuData::insertItem ( const <a href="qpixmap.html">QPixmap</a> & pixmap, int id = -1, int index = -1 )
|
---|
392 | </h3>
|
---|
393 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
394 | <p> Inserts a menu item with pixmap <em>pixmap</em>, optional id <em>id</em>, and
|
---|
395 | optional <em>index</em> position.
|
---|
396 | <p> To look best when being highlighted as a menu item, the pixmap
|
---|
397 | should provide a mask (see <a href="qpixmap.html#mask">QPixmap::mask</a>()).
|
---|
398 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
399 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), and <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
400 |
|
---|
401 | <h3 class=fn>int <a name="insertItem-a"></a>QMenuData::insertItem ( const <a href="qiconset.html">QIconSet</a> & icon, const <a href="qpixmap.html">QPixmap</a> & pixmap, int id = -1, int index = -1 )
|
---|
402 | </h3>
|
---|
403 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
404 | <p> Inserts a menu item with icon <em>icon</em>, pixmap <em>pixmap</em>, optional
|
---|
405 | id <em>id</em>, and optional <em>index</em> position. The icon will be
|
---|
406 | displayed to the left of the pixmap in the item.
|
---|
407 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
408 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), and <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
409 |
|
---|
410 | <h3 class=fn>int <a name="insertItem-b"></a>QMenuData::insertItem ( const <a href="qpixmap.html">QPixmap</a> & pixmap, <a href="qpopupmenu.html">QPopupMenu</a> * popup, int id = -1, int index = -1 )
|
---|
411 | </h3>
|
---|
412 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
413 | <p> Inserts a menu item with pixmap <em>pixmap</em>, submenu <em>popup</em>,
|
---|
414 | optional id <em>id</em>, and optional <em>index</em> position.
|
---|
415 | <p> The <em>popup</em> must be deleted by the programmer or by its parent
|
---|
416 | widget. It is not deleted when this menu item is removed or when
|
---|
417 | the menu is deleted.
|
---|
418 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
419 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), and <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
420 |
|
---|
421 | <h3 class=fn>int <a name="insertItem-c"></a>QMenuData::insertItem ( const <a href="qiconset.html">QIconSet</a> & icon, const <a href="qpixmap.html">QPixmap</a> & pixmap, <a href="qpopupmenu.html">QPopupMenu</a> * popup, int id = -1, int index = -1 )
|
---|
422 | </h3>
|
---|
423 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
424 | <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
|
---|
425 | will be displayed to the left of the pixmap in the item.
|
---|
426 | <p> The <em>popup</em> must be deleted by the programmer or by its parent
|
---|
427 | widget. It is not deleted when this menu item is removed or when
|
---|
428 | the menu is deleted.
|
---|
429 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
430 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>(), <a href="qmenudata.html#changeItem">changeItem</a>(), <a href="qmenudata.html#setAccel">setAccel</a>(), and <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
431 |
|
---|
432 | <h3 class=fn>int <a name="insertItem-d"></a>QMenuData::insertItem ( <a href="qwidget.html">QWidget</a> * widget, int id = -1, int index = -1 )
|
---|
433 | </h3>
|
---|
434 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
435 | <p> Inserts a menu item that consists of the widget <em>widget</em> with
|
---|
436 | optional id <em>id</em>, and optional <em>index</em> position.
|
---|
437 | <p> Ownership of <em>widget</em> is transferred to the popup menu or to the
|
---|
438 | menu bar.
|
---|
439 | <p> Theoretically, any widget can be inserted into a popup menu. In
|
---|
440 | practice, this only makes sense with certain widgets.
|
---|
441 | <p> If a widget is not focus-enabled (see
|
---|
442 | <a href="qwidget.html#isFocusEnabled">QWidget::isFocusEnabled</a>()), the menu treats it as a separator;
|
---|
443 | this means that the item is not selectable and will never get
|
---|
444 | focus. In this way you can, for example, simply insert a <a href="qlabel.html">QLabel</a> if
|
---|
445 | you need a popup menu with a title.
|
---|
446 | <p> If the widget is focus-enabled it will get focus when the user
|
---|
447 | traverses the popup menu with the arrow keys. If the widget does
|
---|
448 | not accept <tt>ArrowUp</tt> and <tt>ArrowDown</tt> in its key event handler,
|
---|
449 | the focus will move back to the menu when the respective arrow key
|
---|
450 | is hit one more time. This works with a <a href="qlineedit.html">QLineEdit</a>, for example. If
|
---|
451 | the widget accepts the arrow key itself, it must also provide the
|
---|
452 | possibility to put the focus back on the menu again by calling
|
---|
453 | <a href="qwidget.html#focusNextPrevChild">QWidget::focusNextPrevChild</a>(). Futhermore, if the embedded widget
|
---|
454 | closes the menu when the user made a selection, this can be done
|
---|
455 | safely by calling:
|
---|
456 | <pre>
|
---|
457 | if ( <a href="qwidget.html#isVisible">isVisible</a>() &&
|
---|
458 | <a href="qwidget.html#parentWidget">parentWidget</a>() &&
|
---|
459 | <a href="qwidget.html#parentWidget">parentWidget</a>()->inherits("QPopupMenu") )
|
---|
460 | <a href="qwidget.html#parentWidget">parentWidget</a>()->close();
|
---|
461 | </pre>
|
---|
462 |
|
---|
463 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
464 | <p> <p>See also <a href="qmenudata.html#removeItem">removeItem</a>().
|
---|
465 |
|
---|
466 | <h3 class=fn>int <a name="insertItem-e"></a>QMenuData::insertItem ( const <a href="qiconset.html">QIconSet</a> & icon, <a href="qcustommenuitem.html">QCustomMenuItem</a> * custom, int id = -1, int index = -1 )
|
---|
467 | </h3>
|
---|
468 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
469 | <p> Inserts a custom menu item <em>custom</em> with an <em>icon</em> and with
|
---|
470 | optional id <em>id</em>, and optional <em>index</em> position.
|
---|
471 | <p> This only works with popup menus. It is not supported for menu
|
---|
472 | bars. Ownership of <em>custom</em> is transferred to the popup menu.
|
---|
473 | <p> If you want to connect a custom item to a slot, use <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
474 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
475 | <p> <p>See also <a href="qmenudata.html#connectItem">connectItem</a>(), <a href="qmenudata.html#removeItem">removeItem</a>(), and <a href="qcustommenuitem.html">QCustomMenuItem</a>.
|
---|
476 |
|
---|
477 | <h3 class=fn>int <a name="insertItem-f"></a>QMenuData::insertItem ( <a href="qcustommenuitem.html">QCustomMenuItem</a> * custom, int id = -1, int index = -1 )
|
---|
478 | </h3>
|
---|
479 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
480 | <p> Inserts a custom menu item <em>custom</em> with optional id <em>id</em>, and
|
---|
481 | optional <em>index</em> position.
|
---|
482 | <p> This only works with popup menus. It is not supported for menu
|
---|
483 | bars. Ownership of <em>custom</em> is transferred to the popup menu.
|
---|
484 | <p> If you want to connect a custom item to a slot, use <a href="qmenudata.html#connectItem">connectItem</a>().
|
---|
485 | <p> Returns the allocated <a href="qmenudata.html#menu-identifier">menu identifier</a> number (<em>id</em> if <em>id</em> >= 0).
|
---|
486 | <p> <p>See also <a href="qmenudata.html#connectItem">connectItem</a>(), <a href="qmenudata.html#removeItem">removeItem</a>(), and <a href="qcustommenuitem.html">QCustomMenuItem</a>.
|
---|
487 |
|
---|
488 | <h3 class=fn>int <a name="insertSeparator"></a>QMenuData::insertSeparator ( int index = -1 )
|
---|
489 | </h3>
|
---|
490 | Inserts a separator at position <em>index</em>, and returns the <a href="qmenudata.html#menu-identifier">menu identifier</a>
|
---|
491 | number allocated to it. The separator becomes the last menu item if
|
---|
492 | <em>index</em> is negative.
|
---|
493 | <p> In a popup menu a separator is rendered as a horizontal line. In a
|
---|
494 | <a href="motif-extension.html#Motif">Motif</a> menu bar a separator is spacing, so the rest of the items
|
---|
495 | (normally just "Help") are drawn right-justified. In a Windows
|
---|
496 | menu bar separators are ignored (to comply with the Windows style
|
---|
497 | guidelines).
|
---|
498 |
|
---|
499 | <p>Examples: <a href="addressbook-example.html#x570">addressbook/mainwindow.cpp</a>, <a href="menu-example.html#x1870">menu/menu.cpp</a>, <a href="progress-example.html#x69">progress/progress.cpp</a>, <a href="qwerty-example.html#x372">qwerty/qwerty.cpp</a>, <a href="scrollview-example.html#x635">scrollview/scrollview.cpp</a>, <a href="showimg-example.html#x1328">showimg/showimg.cpp</a>, and <a href="sound-example.html#x2811">sound/sound.cpp</a>.
|
---|
500 | <h3 class=fn>bool <a name="isDefaultUp"></a>QMenuBar::isDefaultUp () const
|
---|
501 | </h3><p>Returns the popup orientation.
|
---|
502 | See the <a href="qmenubar.html#defaultUp-prop">"defaultUp"</a> property for details.
|
---|
503 | <h3 class=fn>bool <a name="isItemEnabled"></a>QMenuData::isItemEnabled ( int id ) const
|
---|
504 | </h3>
|
---|
505 | Returns TRUE if the item with identifier <em>id</em> is enabled;
|
---|
506 | otherwise returns FALSE
|
---|
507 | <p> <p>See also <a href="qmenudata.html#setItemEnabled">setItemEnabled</a>() and <a href="qmenudata.html#isItemVisible">isItemVisible</a>().
|
---|
508 |
|
---|
509 | <h3 class=fn>bool <a name="isItemVisible"></a>QMenuData::isItemVisible ( int id ) const
|
---|
510 | </h3>
|
---|
511 | Returns TRUE if the menu item with the id <em>id</em> is visible;
|
---|
512 | otherwise returns FALSE.
|
---|
513 | <p> <p>See also <a href="qmenudata.html#setItemVisible">setItemVisible</a>().
|
---|
514 |
|
---|
515 | <h3 class=fn>void <a name="menuContentsChanged"></a>QMenuBar::menuContentsChanged ()<tt> [virtual protected]</tt>
|
---|
516 | </h3>
|
---|
517 | Recomputes the menu bar's display data according to the new
|
---|
518 | contents.
|
---|
519 | <p> You should never need to call this; it is called automatically by
|
---|
520 | <a href="qmenudata.html">QMenuData</a> whenever it needs to be called.
|
---|
521 |
|
---|
522 | <p>Reimplemented from <a href="qmenudata.html#menuContentsChanged">QMenuData</a>.
|
---|
523 | <h3 class=fn>void <a name="menuStateChanged"></a>QMenuBar::menuStateChanged ()<tt> [virtual protected]</tt>
|
---|
524 | </h3>
|
---|
525 | Recomputes the menu bar's display data according to the new state.
|
---|
526 | <p> You should never need to call this; it is called automatically by
|
---|
527 | <a href="qmenudata.html">QMenuData</a> whenever it needs to be called.
|
---|
528 |
|
---|
529 | <p>Reimplemented from <a href="qmenudata.html#menuStateChanged">QMenuData</a>.
|
---|
530 | <h3 class=fn>void <a name="removeItem"></a>QMenuData::removeItem ( int id )
|
---|
531 | </h3>
|
---|
532 |
|
---|
533 | <p> Removes the menu item that has the identifier <em>id</em>.
|
---|
534 | <p> <p>See also <a href="qmenudata.html#removeItemAt">removeItemAt</a>() and <a href="qmenudata.html#clear">clear</a>().
|
---|
535 |
|
---|
536 | <p>Example: <a href="canvas-chart-example.html#x2885">chart/chartform.cpp</a>.
|
---|
537 | <h3 class=fn><a href="qmenubar.html#Separator-enum">Separator</a> <a name="separator"></a>QMenuBar::separator () const
|
---|
538 | </h3><p>Returns in which cases a menubar sparator is drawn.
|
---|
539 | See the <a href="qmenubar.html#separator-prop">"separator"</a> property for details.
|
---|
540 | <h3 class=fn>void <a name="setDefaultUp"></a>QMenuBar::setDefaultUp ( bool )
|
---|
541 | </h3><p>Sets the popup orientation.
|
---|
542 | See the <a href="qmenubar.html#defaultUp-prop">"defaultUp"</a> property for details.
|
---|
543 | <h3 class=fn>void <a name="setItemEnabled"></a>QMenuData::setItemEnabled ( int id, bool enable )
|
---|
544 | </h3>
|
---|
545 | If <em>enable</em> is TRUE, enables the menu item with identifier <em>id</em>;
|
---|
546 | otherwise disables the menu item with identifier <em>id</em>.
|
---|
547 | <p> <p>See also <a href="qmenudata.html#isItemEnabled">isItemEnabled</a>().
|
---|
548 |
|
---|
549 | <p>Examples: <a href="mdi-example.html#x2033">mdi/application.cpp</a>, <a href="menu-example.html#x1873">menu/menu.cpp</a>, <a href="progress-example.html#x72">progress/progress.cpp</a>, and <a href="showimg-example.html#x1331">showimg/showimg.cpp</a>.
|
---|
550 | <h3 class=fn>void <a name="setItemVisible"></a>QMenuData::setItemVisible ( int id, bool visible )
|
---|
551 | </h3>
|
---|
552 | If <em>visible</em> is TRUE, shows the menu item with id <em>id</em>; otherwise
|
---|
553 | hides the menu item with id <em>id</em>.
|
---|
554 | <p> <p>See also <a href="qmenudata.html#isItemVisible">isItemVisible</a>() and <a href="qmenudata.html#isItemEnabled">isItemEnabled</a>().
|
---|
555 |
|
---|
556 | <h3 class=fn>void <a name="setSeparator"></a>QMenuBar::setSeparator ( <a href="qmenubar.html#Separator-enum">Separator</a> when )<tt> [virtual]</tt>
|
---|
557 | </h3><p>Sets in which cases a menubar sparator is drawn to <em>when</em>.
|
---|
558 | See the <a href="qmenubar.html#separator-prop">"separator"</a> property for details.
|
---|
559 | <h3 class=fn>void <a name="show"></a>QMenuBar::show ()<tt> [virtual]</tt>
|
---|
560 | </h3>
|
---|
561 | Reimplements <a href="qwidget.html#show">QWidget::show</a>() in order to set up the correct
|
---|
562 | keyboard accelerators and to raise itself to the top of the widget
|
---|
563 | stack.
|
---|
564 |
|
---|
565 | <p>Example: <a href="grapher-nsplugin-example.html#x2746">grapher/grapher.cpp</a>.
|
---|
566 | <p>Reimplemented from <a href="qwidget.html#show">QWidget</a>.
|
---|
567 | <hr><h2>Property Documentation</h2>
|
---|
568 | <h3 class=fn>bool <a name="defaultUp-prop"></a>defaultUp</h3>
|
---|
569 | <p>This property holds the popup orientation.
|
---|
570 | <p>The default popup orientation. By default, menus pop "down" the
|
---|
571 | screen. By setting the property to TRUE, the menu will pop "up".
|
---|
572 | You might call this for menus that are <em>below</em> the document to
|
---|
573 | which they refer.
|
---|
574 | <p> If the menu would not fit on the screen, the other direction is
|
---|
575 | used automatically.
|
---|
576 |
|
---|
577 | <p>Set this property's value with <a href="#setDefaultUp">setDefaultUp</a>() and get this property's value with <a href="#isDefaultUp">isDefaultUp</a>().
|
---|
578 | <h3 class=fn><a href="qmenubar.html#Separator-enum">Separator</a> <a name="separator-prop"></a>separator</h3>
|
---|
579 | <p>This property holds in which cases a menubar sparator is drawn.
|
---|
580 | <p><b>This property is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
581 | <p>
|
---|
582 | <p>Set this property's value with <a href="#setSeparator">setSeparator</a>() and get this property's value with <a href="#separator">separator</a>().
|
---|
583 | <!-- eof -->
|
---|
584 | <hr><p>
|
---|
585 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
586 | Copyright © 1995-2007
|
---|
587 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
588 | <table width=100% cellspacing=0 border=0><tr>
|
---|
589 | <td>Copyright © 2007
|
---|
590 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
591 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
592 | </table></div></address></body>
|
---|
593 | </html>
|
---|