You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
338 lines
20 KiB
338 lines
20 KiB
14 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qaccel.cpp:51 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>QAccel Class</title>
|
||
|
<style type="text/css"><!--
|
||
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
||
|
a:link { color: #004faf; text-decoration: none }
|
||
|
a:visited { color: #672967; text-decoration: none }
|
||
|
body { background: #ffffff; color: black; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||
|
<tr bgcolor="#E5E5E5">
|
||
|
<td valign=center>
|
||
|
<a href="index.html">
|
||
|
<font color="#004faf">Home</font></a>
|
||
|
| <a href="classes.html">
|
||
|
<font color="#004faf">All Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped Classes</font></a>
|
||
|
| <a href="functions.html">
|
||
|
<font color="#004faf">Functions</font></a>
|
||
|
</td>
|
||
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QAccel Class Reference</h1>
|
||
|
|
||
|
<p>The QAccel class handles keyboard accelerator and shortcut keys.
|
||
|
<a href="#details">More...</a>
|
||
|
<p><tt>#include <<a href="qaccel-h.html">qaccel.h</a>></tt>
|
||
|
<p>Inherits <a href="qobject.html">QObject</a>.
|
||
|
<p><a href="qaccel-members.html">List of all member functions.</a>
|
||
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#QAccel"><b>QAccel</b></a> ( QWidget * parent, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#QAccel-2"><b>QAccel</b></a> ( QWidget * watch, QObject * parent, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#~QAccel"><b>~QAccel</b></a> ()</li>
|
||
|
<li class=fn>bool <a href="#isEnabled"><b>isEnabled</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setEnabled"><b>setEnabled</b></a> ( bool enable )</li>
|
||
|
<li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
|
||
|
<li class=fn>int <a href="#insertItem"><b>insertItem</b></a> ( const QKeySequence & key, int id = -1 )</li>
|
||
|
<li class=fn>void <a href="#removeItem"><b>removeItem</b></a> ( int id )</li>
|
||
|
<li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
|
||
|
<li class=fn>QKeySequence <a href="#key"><b>key</b></a> ( int id )</li>
|
||
|
<li class=fn>int <a href="#findKey"><b>findKey</b></a> ( const QKeySequence & key ) const</li>
|
||
|
<li class=fn>bool <a href="#isItemEnabled"><b>isItemEnabled</b></a> ( int id ) const</li>
|
||
|
<li class=fn>void <a href="#setItemEnabled"><b>setItemEnabled</b></a> ( int id, bool enable )</li>
|
||
|
<li class=fn>bool <a href="#connectItem"><b>connectItem</b></a> ( int id, const QObject * receiver, const char * member )</li>
|
||
|
<li class=fn>bool <a href="#disconnectItem"><b>disconnectItem</b></a> ( int id, const QObject * receiver, const char * member )</li>
|
||
|
<li class=fn>void repairEventFilter () <em>(obsolete)</em></li>
|
||
|
<li class=fn>void <a href="#setWhatsThis"><b>setWhatsThis</b></a> ( int id, const QString & text )</li>
|
||
|
<li class=fn>QString <a href="#whatsThis"><b>whatsThis</b></a> ( int id ) const</li>
|
||
|
</ul>
|
||
|
<h2>Signals</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#activated"><b>activated</b></a> ( int id )</li>
|
||
|
<li class=fn>void <a href="#activatedAmbiguously"><b>activatedAmbiguously</b></a> ( int id )</li>
|
||
|
</ul>
|
||
|
<h2>Static Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn>QKeySequence <a href="#shortcutKey"><b>shortcutKey</b></a> ( const QString & str )</li>
|
||
|
<li class=fn>QString keyToString ( QKeySequence k ) <em>(obsolete)</em></li>
|
||
|
<li class=fn>QKeySequence stringToKey ( const QString & s ) <em>(obsolete)</em></li>
|
||
|
</ul>
|
||
|
<h2>Protected Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn>virtual bool eventFilter ( QObject *, QEvent * ) <em>(obsolete)</em></li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The QAccel class handles keyboard accelerator and shortcut keys.
|
||
|
<p>
|
||
|
<p> A keyboard accelerator triggers an action when a certain key
|
||
|
combination is pressed. The accelerator handles all keyboard
|
||
|
activity for all the children of one top-level widget, so it is
|
||
|
not affected by the <a href="focus.html#keyboard-focus">keyboard focus</a>.
|
||
|
<p> In most cases, you will not need to use this class directly. Use
|
||
|
the <a href="qaction.html">QAction</a> class to create actions with accelerators that can be
|
||
|
used in both menus and toolbars. If you're only interested in
|
||
|
menus use <a href="qmenudata.html#insertItem">QMenuData::insertItem</a>() or <a href="qmenudata.html#setAccel">QMenuData::setAccel</a>() to make
|
||
|
accelerators for operations that are also available on menus. Many
|
||
|
widgets automatically generate accelerators, such as <a href="qbutton.html">QButton</a>,
|
||
|
<a href="qgroupbox.html">QGroupBox</a>, <a href="qlabel.html">QLabel</a> (with <a href="qlabel.html#setBuddy">QLabel::setBuddy</a>()), <a href="qmenubar.html">QMenuBar</a> and <a href="qtabbar.html">QTabBar</a>.
|
||
|
Example:
|
||
|
<pre>
|
||
|
<a href="qpushbutton.html">QPushButton</a> p( "&Exit", parent ); // automatic shortcut ALT+Key_E
|
||
|
<a href="qpopupmenu.html">QPopupMenu</a> *fileMenu = new fileMenu( parent );
|
||
|
fileMenu-><a href="qmenudata.html#insertItem">insertItem</a>( "Undo", parent, SLOT(undo()), CTRL+Key_Z );
|
||
|
</pre>
|
||
|
|
||
|
<p> A QAccel contains a list of accelerator items that can be
|
||
|
manipulated using <a href="#insertItem">insertItem</a>(), <a href="#removeItem">removeItem</a>(), <a href="#clear">clear</a>(), <a href="#key">key</a>() and
|
||
|
<a href="#findKey">findKey</a>().
|
||
|
<p> Each accelerator item consists of an identifier and a <a href="qkeysequence.html">QKeySequence</a>. A single key sequence consists of a keyboard code
|
||
|
combined with modifiers (<a href="qt.html#Modifier-enum">SHIFT</a>, <a href="qt.html#Modifier-enum">CTRL</a>, <a href="qt.html#Modifier-enum">ALT</a> or <a href="qt.html#Modifier-enum">UNICODE_ACCEL</a>). For example, <tt>CTRL + Key_P</tt> could be a shortcut
|
||
|
for printing a document. The key codes are listed in <a href="qnamespace-h.html">qnamespace.h</a>. As an alternative, use <a href="qt.html#Modifier-enum">UNICODE_ACCEL</a> with the
|
||
|
unicode code point of the character. For example, <tt>UNICODE_ACCEL + 'A'</tt> gives the same accelerator as <a href="qt.html#Key-enum">Key_A</a>.
|
||
|
<p> When an accelerator key is pressed, the accelerator sends out the
|
||
|
signal <a href="#activated">activated</a>() with a number that identifies this particular
|
||
|
accelerator item. Accelerator items can also be individually
|
||
|
connected, so that two different keys will activate two different
|
||
|
slots (see <a href="#connectItem">connectItem</a>() and <a href="#disconnectItem">disconnectItem</a>()).
|
||
|
<p> The activated() signal is <em>not</em> emitted when two or more
|
||
|
accelerators match the same key. Instead, the first matching
|
||
|
accelerator sends out the <a href="#activatedAmbiguously">activatedAmbiguously</a>() signal. By
|
||
|
pressing the key multiple times, users can navigate between all
|
||
|
matching accelerators. Some standard controls like <a href="qpushbutton.html">QPushButton</a> and
|
||
|
<a href="qcheckbox.html">QCheckBox</a> connect the activatedAmbiguously() signal to the
|
||
|
harmless setFocus() slot, whereas activated() is connected to a
|
||
|
slot invoking the button's action. Most controls, like <a href="qlabel.html">QLabel</a> and
|
||
|
<a href="qtabbar.html">QTabBar</a>, treat activated() and activatedAmbiguously() as
|
||
|
equivalent.
|
||
|
<p> Use <a href="#setEnabled">setEnabled</a>() to enable or disable all the items in an
|
||
|
accelerator, or <a href="#setItemEnabled">setItemEnabled</a>() to enable or disable individual
|
||
|
items. An item is active only when both the QAccel and the item
|
||
|
itself are enabled.
|
||
|
<p> The function <a href="#setWhatsThis">setWhatsThis</a>() specifies a help text that appears
|
||
|
when the user presses an accelerator key in What's This mode.
|
||
|
<p> The accelerator will be deleted when <em>parent</em> is deleted,
|
||
|
and will consume relevant key events until then.
|
||
|
<p> Please note that the accelerator
|
||
|
<pre>
|
||
|
accelerator->insertItem( QKeySequence("M") );
|
||
|
</pre>
|
||
|
|
||
|
can be triggered with both the 'M' key, and with Shift+M,
|
||
|
unless a second accelerator is defined for the Shift+M
|
||
|
combination.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
|
QAccel *a = new QAccel( myWindow ); // create accels for myWindow
|
||
|
a-><a href="#connectItem">connectItem</a>( a-><a href="#insertItem">insertItem</a>(Key_P+CTRL), // adds Ctrl+P accelerator
|
||
|
myWindow, // connected to myWindow's
|
||
|
SLOT(printDoc()) ); // printDoc() slot
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="qkeyevent.html">QKeyEvent</a>, <a href="qwidget.html#keyPressEvent">QWidget::keyPressEvent</a>(), <a href="qmenudata.html#setAccel">QMenuData::setAccel</a>(), <a href="qbutton.html#accel-prop">QButton::accel</a>, <a href="qlabel.html#setBuddy">QLabel::setBuddy</a>(), <a href="qkeysequence.html">QKeySequence</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Keyboard Shortcuts</a>, and <a href="misc.html">Miscellaneous Classes</a>.
|
||
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
|
<h3 class=fn><a name="QAccel"></a>QAccel::QAccel ( <a href="qwidget.html">QWidget</a> * parent, const char * name = 0 )
|
||
|
</h3>
|
||
|
Constructs a QAccel object called <em>name</em>, with parent <em>parent</em>.
|
||
|
The accelerator operates on <em>parent</em>.
|
||
|
|
||
|
<h3 class=fn><a name="QAccel-2"></a>QAccel::QAccel ( <a href="qwidget.html">QWidget</a> * watch, <a href="qobject.html">QObject</a> * parent, const char * name = 0 )
|
||
|
</h3>
|
||
|
Constructs a QAccel object called <em>name</em>, that operates on <em>watch</em>, and is a child of <em>parent</em>.
|
||
|
<p> This constructor is not needed for normal application programming.
|
||
|
|
||
|
<h3 class=fn><a name="~QAccel"></a>QAccel::~QAccel ()
|
||
|
</h3>
|
||
|
Destroys the accelerator object and frees all allocated resources.
|
||
|
|
||
|
<h3 class=fn>void <a name="activated"></a>QAccel::activated ( int id )<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted when an accelerator key is pressed. <em>id</em>
|
||
|
is a number that identifies this particular accelerator item.
|
||
|
<p> <p>See also <a href="#activatedAmbiguously">activatedAmbiguously</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="activatedAmbiguously"></a>QAccel::activatedAmbiguously ( int id )<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted when an accelerator key is pressed. <em>id</em>
|
||
|
is a number that identifies this particular accelerator item.
|
||
|
<p> <p>See also <a href="#activated">activated</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="clear"></a>QAccel::clear ()
|
||
|
</h3>
|
||
|
Removes all accelerator items.
|
||
|
|
||
|
<h3 class=fn>bool <a name="connectItem"></a>QAccel::connectItem ( int id, const <a href="qobject.html">QObject</a> * receiver, const char * member )
|
||
|
</h3>
|
||
|
Connects the accelerator item <em>id</em> to the slot <em>member</em> of <em>receiver</em>.
|
||
|
<p> <pre>
|
||
|
a->connectItem( 201, mainView, SLOT(quit()) );
|
||
|
</pre>
|
||
|
|
||
|
<p> Of course, you can also send a signal as <em>member</em>.
|
||
|
<p> Normally accelerators are connected to slots which then receive
|
||
|
the <tt>activated(int id)</tt> signal with the id of the accelerator
|
||
|
item that was activated. If you choose to connect a specific
|
||
|
accelerator item using this function, the <a href="#activated">activated</a>() signal is
|
||
|
emitted if the associated key sequence is pressed but no <tt>activated(int id)</tt> signal is emitted.
|
||
|
<p> <p>See also <a href="#disconnectItem">disconnectItem</a>().
|
||
|
|
||
|
<p>Example: <a href="tutorial1-14.html#x2437">t14/gamebrd.cpp</a>.
|
||
|
<h3 class=fn>uint <a name="count"></a>QAccel::count () const
|
||
|
</h3>
|
||
|
Returns the number of accelerator items in this accelerator.
|
||
|
|
||
|
<h3 class=fn>bool <a name="disconnectItem"></a>QAccel::disconnectItem ( int id, const <a href="qobject.html">QObject</a> * receiver, const char * member )
|
||
|
</h3>
|
||
|
Disconnects an accelerator item with id <em>id</em> from the function
|
||
|
called <em>member</em> in the <em>receiver</em> object.
|
||
|
<p> <p>See also <a href="#connectItem">connectItem</a>().
|
||
|
|
||
|
<h3 class=fn>bool <a name="eventFilter"></a>QAccel::eventFilter ( <a href="qobject.html">QObject</a> *, <a href="qevent.html">QEvent</a> * )<tt> [virtual protected]</tt>
|
||
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
serves no purpose anymore
|
||
|
<p>Reimplemented from <a href="qobject.html#eventFilter">QObject</a>.
|
||
|
<h3 class=fn>int <a name="findKey"></a>QAccel::findKey ( const <a href="qkeysequence.html">QKeySequence</a> & key ) const
|
||
|
</h3>
|
||
|
Returns the identifier of the accelerator item with the key code
|
||
|
<em>key</em>, or -1 if the item cannot be found.
|
||
|
|
||
|
<h3 class=fn>int <a name="insertItem"></a>QAccel::insertItem ( const <a href="qkeysequence.html">QKeySequence</a> & key, int id = -1 )
|
||
|
</h3>
|
||
|
Inserts an accelerator item and returns the item's identifier.
|
||
|
<p> <em>key</em> is a key code and an optional combination of SHIFT, CTRL
|
||
|
and ALT. <em>id</em> is the accelerator item id.
|
||
|
<p> If <em>id</em> is negative, then the item will be assigned a unique
|
||
|
negative identifier less than -1.
|
||
|
<p> <pre>
|
||
|
QAccel *a = new QAccel( myWindow ); // create accels for myWindow
|
||
|
a-><a href="#insertItem">insertItem</a>( CTRL + Key_P, 200 ); // Ctrl+P, e.g. to print document
|
||
|
a-><a href="#insertItem">insertItem</a>( ALT + Key_X, 201 ); // Alt+X, e.g. to quit
|
||
|
a-><a href="#insertItem">insertItem</a>( UNICODE_ACCEL + 'q', 202 ); // Unicode 'q', e.g. to quit
|
||
|
a-><a href="#insertItem">insertItem</a>( <a href="qt.html#Key-enum">Key_D</a> ); // gets a unique negative id < -1
|
||
|
a-><a href="#insertItem">insertItem</a>( CTRL + SHIFT + Key_P ); // gets a unique negative id < -1
|
||
|
</pre>
|
||
|
|
||
|
|
||
|
<p>Example: <a href="tutorial1-14.html#x2438">t14/gamebrd.cpp</a>.
|
||
|
<h3 class=fn>bool <a name="isEnabled"></a>QAccel::isEnabled () const
|
||
|
</h3>
|
||
|
Returns TRUE if the accelerator is enabled; otherwise returns
|
||
|
FALSE.
|
||
|
<p> <p>See also <a href="#setEnabled">setEnabled</a>() and <a href="#isItemEnabled">isItemEnabled</a>().
|
||
|
|
||
|
<h3 class=fn>bool <a name="isItemEnabled"></a>QAccel::isItemEnabled ( int id ) const
|
||
|
</h3>
|
||
|
Returns TRUE if the accelerator item with the identifier <em>id</em> is
|
||
|
enabled. Returns FALSE if the item is disabled or cannot be found.
|
||
|
<p> <p>See also <a href="#setItemEnabled">setItemEnabled</a>() and <a href="#isEnabled">isEnabled</a>().
|
||
|
|
||
|
<h3 class=fn><a href="qkeysequence.html">QKeySequence</a> <a name="key"></a>QAccel::key ( int id )
|
||
|
</h3>
|
||
|
Returns the key sequence of the accelerator item with identifier
|
||
|
<em>id</em>, or an invalid key sequence (0) if the id cannot be found.
|
||
|
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="keyToString"></a>QAccel::keyToString ( <a href="qkeysequence.html">QKeySequence</a> k )<tt> [static]</tt>
|
||
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
<p> Creates an accelerator string for the key <em>k</em>.
|
||
|
For instance CTRL+Key_O gives "Ctrl+O". The "Ctrl" etc.
|
||
|
are translated (using <a href="qobject.html#tr">QObject::tr</a>()) in the "QAccel" context.
|
||
|
<p> The function is superfluous. Cast the <a href="qkeysequence.html">QKeySequence</a> <em>k</em> to a
|
||
|
<a href="qstring.html">QString</a> for the same effect.
|
||
|
|
||
|
<h3 class=fn>void <a name="removeItem"></a>QAccel::removeItem ( int id )
|
||
|
</h3>
|
||
|
Removes the accelerator item with the identifier <em>id</em>.
|
||
|
|
||
|
<h3 class=fn>void <a name="repairEventFilter"></a>QAccel::repairEventFilter ()
|
||
|
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
serves no purpose anymore
|
||
|
<h3 class=fn>void <a name="setEnabled"></a>QAccel::setEnabled ( bool enable )
|
||
|
</h3>
|
||
|
Enables the accelerator if <em>enable</em> is TRUE, or disables it if <em>enable</em> is FALSE.
|
||
|
<p> Individual keys can also be enabled or disabled using
|
||
|
<a href="#setItemEnabled">setItemEnabled</a>(). To work, a key must be an enabled item in an
|
||
|
enabled QAccel.
|
||
|
<p> <p>See also <a href="#isEnabled">isEnabled</a>() and <a href="#setItemEnabled">setItemEnabled</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="setItemEnabled"></a>QAccel::setItemEnabled ( int id, bool enable )
|
||
|
</h3>
|
||
|
Enables the accelerator item with the identifier <em>id</em> if <em>enable</em> is TRUE, and disables item <em>id</em> if <em>enable</em> is FALSE.
|
||
|
<p> To work, an item must be enabled and be in an enabled QAccel.
|
||
|
<p> <p>See also <a href="#isItemEnabled">isItemEnabled</a>() and <a href="#isEnabled">isEnabled</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="setWhatsThis"></a>QAccel::setWhatsThis ( int id, const <a href="qstring.html">QString</a> & text )
|
||
|
</h3>
|
||
|
Sets a What's This help text for the accelerator item <em>id</em> to <em>text</em>.
|
||
|
<p> The text will be shown when the application is in What's This mode
|
||
|
and the user hits the accelerator key.
|
||
|
<p> To set What's This help on a menu item (with or without an
|
||
|
accelerator key), use <a href="qmenudata.html#setWhatsThis">QMenuData::setWhatsThis</a>().
|
||
|
<p> <p>See also <a href="#whatsThis">whatsThis</a>(), <a href="qwhatsthis.html#inWhatsThisMode">QWhatsThis::inWhatsThisMode</a>(), <a href="qmenudata.html#setWhatsThis">QMenuData::setWhatsThis</a>(), and <a href="qaction.html#whatsThis-prop">QAction::whatsThis</a>.
|
||
|
|
||
|
<h3 class=fn><a href="qkeysequence.html">QKeySequence</a> <a name="shortcutKey"></a>QAccel::shortcutKey ( const <a href="qstring.html">QString</a> & str )<tt> [static]</tt>
|
||
|
</h3>
|
||
|
Returns the shortcut key sequence for <em>str</em>, or an invalid key
|
||
|
sequence (0) if <em>str</em> has no shortcut sequence.
|
||
|
<p> For example, <a href="#shortcutKey">shortcutKey</a>("E&xit") returns ALT+Key_X,
|
||
|
shortcutKey("&Quit") returns ALT+Key_Q and shortcutKey("Quit")
|
||
|
returns 0. (In code that does not inherit the Qt namespace class,
|
||
|
you must write e.g. Qt::ALT+Qt::Key_Q.)
|
||
|
<p> We provide a <a href="accelerators.html">list of common accelerators</a> in English. At the time of writing, Microsoft and Open
|
||
|
Group do not appear to have issued equivalent recommendations for
|
||
|
other languages.
|
||
|
|
||
|
<h3 class=fn><a href="qkeysequence.html">QKeySequence</a> <a name="stringToKey"></a>QAccel::stringToKey ( const <a href="qstring.html">QString</a> & s )<tt> [static]</tt>
|
||
|
</h3><b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
<p> Returns an accelerator code for the string <em>s</em>. For example
|
||
|
"Ctrl+O" gives CTRL+UNICODE_ACCEL+'O'. The strings "Ctrl",
|
||
|
"Shift", "Alt" are recognized, as well as their translated
|
||
|
equivalents in the "QAccel" context (using <a href="qobject.html#tr">QObject::tr</a>()). Returns 0
|
||
|
if <em>s</em> is not recognized.
|
||
|
<p> This function is typically used with <a href="qobject.html#tr">tr</a>(), so that accelerator keys can be replaced in
|
||
|
translations:
|
||
|
<p> <pre>
|
||
|
<a href="qpopupmenu.html">QPopupMenu</a> *file = new <a href="qpopupmenu.html">QPopupMenu</a>( this );
|
||
|
file-><a href="qmenudata.html#insertItem">insertItem</a>( p1, tr("&Open..."), this, SLOT(open()),
|
||
|
QAccel::<a href="#stringToKey">stringToKey</a>(<a href="qobject.html#tr">tr</a>("Ctrl+O", "File|Open")) );
|
||
|
</pre>
|
||
|
|
||
|
<p> Notice the <tt>"File|Open"</tt> translator comment. It is by no means
|
||
|
necessary, but it provides some context for the human translator.
|
||
|
<p> The function is superfluous. Construct a <a href="qkeysequence.html">QKeySequence</a> from the
|
||
|
string <em>s</em> for the same effect.
|
||
|
<p> <p>See also <a href="qobject.html#tr">QObject::tr</a>() and <a href="i18n.html">Internationalization with Qt</a>.
|
||
|
|
||
|
<p>Example: <a href="i18n-example.html#x1921">i18n/mywidget.cpp</a>.
|
||
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="whatsThis"></a>QAccel::whatsThis ( int id ) const
|
||
|
</h3>
|
||
|
Returns the What's This help text for the specified item <em>id</em> or
|
||
|
<a href="qstring.html#QString-null">QString::null</a> if no text has been specified.
|
||
|
<p> <p>See also <a href="#setWhatsThis">setWhatsThis</a>().
|
||
|
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">Qt toolkit</a>.
|
||
|
Copyright © 1995-2007
|
||
|
<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 © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>Qt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|