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
21 KiB
338 lines
21 KiB
13 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>TQAccel 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>TQAccel Class Reference</h1>
|
||
|
|
||
|
<p>The TQAccel class handles keyboard accelerator and shortcut keys.
|
||
|
<a href="#details">More...</a>
|
||
13 years ago
|
<p><tt>#include <<a href="qaccel-h.html">ntqaccel.h</a>></tt>
|
||
|
<p>Inherits <a href="ntqobject.html">TQObject</a>.
|
||
13 years ago
|
<p><a href="qaccel-members.html">List of all member functions.</a>
|
||
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#TQAccel"><b>TQAccel</b></a> ( TQWidget * parent, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#TQAccel-2"><b>TQAccel</b></a> ( TQWidget * watch, TQObject * parent, const char * name = 0 )</li>
|
||
|
<li class=fn><a href="#~TQAccel"><b>~TQAccel</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 TQKeySequence & 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>TQKeySequence <a href="#key"><b>key</b></a> ( int id )</li>
|
||
|
<li class=fn>int <a href="#findKey"><b>findKey</b></a> ( const TQKeySequence & 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 TQObject * receiver, const char * member )</li>
|
||
|
<li class=fn>bool <a href="#disconnectItem"><b>disconnectItem</b></a> ( int id, const TQObject * 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 TQString & text )</li>
|
||
|
<li class=fn>TQString <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>TQKeySequence <a href="#shortcutKey"><b>shortcutKey</b></a> ( const TQString & str )</li>
|
||
|
<li class=fn>TQString keyToString ( TQKeySequence k ) <em>(obsolete)</em></li>
|
||
|
<li class=fn>TQKeySequence stringToKey ( const TQString & s ) <em>(obsolete)</em></li>
|
||
|
</ul>
|
||
|
<h2>Protected Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn>virtual bool eventFilter ( TQObject *, TQEvent * ) <em>(obsolete)</em></li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The TQAccel 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
|
||
13 years ago
|
the <a href="ntqaction.html">TQAction</a> class to create actions with accelerators that can be
|
||
13 years ago
|
used in both menus and toolbars. If you're only interested in
|
||
13 years ago
|
menus use <a href="ntqmenudata.html#insertItem">TQMenuData::insertItem</a>() or <a href="ntqmenudata.html#setAccel">TQMenuData::setAccel</a>() to make
|
||
13 years ago
|
accelerators for operations that are also available on menus. Many
|
||
13 years ago
|
widgets automatically generate accelerators, such as <a href="ntqbutton.html">TQButton</a>,
|
||
|
<a href="ntqgroupbox.html">TQGroupBox</a>, <a href="ntqlabel.html">TQLabel</a> (with <a href="ntqlabel.html#setBuddy">TQLabel::setBuddy</a>()), <a href="ntqmenubar.html">TQMenuBar</a> and <a href="ntqtabbar.html">TQTabBar</a>.
|
||
13 years ago
|
Example:
|
||
|
<pre>
|
||
13 years ago
|
<a href="ntqpushbutton.html">TQPushButton</a> p( "&Exit", parent ); // automatic shortcut ALT+Key_E
|
||
|
<a href="ntqpopupmenu.html">TQPopupMenu</a> *fileMenu = new fileMenu( parent );
|
||
|
fileMenu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "Undo", parent, SLOT(undo()), CTRL+Key_Z );
|
||
13 years ago
|
</pre>
|
||
|
|
||
|
<p> A TQAccel 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>().
|
||
13 years ago
|
<p> Each accelerator item consists of an identifier and a <a href="ntqkeysequence.html">TQKeySequence</a>. A single key sequence consists of a keyboard code
|
||
|
combined with modifiers (<a href="ntqt.html#Modifier-enum">SHIFT</a>, <a href="ntqt.html#Modifier-enum">CTRL</a>, <a href="ntqt.html#Modifier-enum">ALT</a> or <a href="ntqt.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">ntqnamespace.h</a>. As an alternative, use <a href="ntqt.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="ntqt.html#Key-enum">Key_A</a>.
|
||
13 years ago
|
<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
|
||
13 years ago
|
matching accelerators. Some standard controls like <a href="ntqpushbutton.html">TQPushButton</a> and
|
||
|
<a href="ntqcheckbox.html">TQCheckBox</a> connect the activatedAmbiguously() signal to the
|
||
13 years ago
|
harmless setFocus() slot, whereas activated() is connected to a
|
||
13 years ago
|
slot invoking the button's action. Most controls, like <a href="ntqlabel.html">TQLabel</a> and
|
||
|
<a href="ntqtabbar.html">TQTabBar</a>, treat activated() and activatedAmbiguously() as
|
||
13 years ago
|
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 TQAccel 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( TQKeySequence("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>
|
||
|
TQAccel *a = new TQAccel( 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>
|
||
|
|
||
13 years ago
|
<p> <p>See also <a href="qkeyevent.html">TQKeyEvent</a>, <a href="ntqwidget.html#keyPressEvent">TQWidget::keyPressEvent</a>(), <a href="ntqmenudata.html#setAccel">TQMenuData::setAccel</a>(), <a href="ntqbutton.html#accel-prop">TQButton::accel</a>, <a href="ntqlabel.html#setBuddy">TQLabel::setBuddy</a>(), <a href="ntqkeysequence.html">TQKeySequence</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Keyboard Shortcuts</a>, and <a href="misc.html">Miscellaneous Classes</a>.
|
||
13 years ago
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
13 years ago
|
<h3 class=fn><a name="TQAccel"></a>TQAccel::TQAccel ( <a href="ntqwidget.html">TQWidget</a> * parent, const char * name = 0 )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a TQAccel object called <em>name</em>, with parent <em>parent</em>.
|
||
|
The accelerator operates on <em>parent</em>.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a name="TQAccel-2"></a>TQAccel::TQAccel ( <a href="ntqwidget.html">TQWidget</a> * watch, <a href="ntqobject.html">TQObject</a> * parent, const char * name = 0 )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a TQAccel 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="~TQAccel"></a>TQAccel::~TQAccel ()
|
||
|
</h3>
|
||
|
Destroys the accelerator object and frees all allocated resources.
|
||
|
|
||
|
<h3 class=fn>void <a name="activated"></a>TQAccel::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>TQAccel::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>TQAccel::clear ()
|
||
|
</h3>
|
||
|
Removes all accelerator items.
|
||
|
|
||
13 years ago
|
<h3 class=fn>bool <a name="connectItem"></a>TQAccel::connectItem ( int id, const <a href="ntqobject.html">TQObject</a> * receiver, const char * member )
|
||
13 years ago
|
</h3>
|
||
|
Connects the accelerator item <em>id</em> to the slot <em>member</em> of <em>receiver</em>.
|
||
|
<p> <pre>
|
||
13 years ago
|
a->connectItem( 201, mainView, SLOT(quit()) );
|
||
13 years ago
|
</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>TQAccel::count () const
|
||
|
</h3>
|
||
|
Returns the number of accelerator items in this accelerator.
|
||
|
|
||
13 years ago
|
<h3 class=fn>bool <a name="disconnectItem"></a>TQAccel::disconnectItem ( int id, const <a href="ntqobject.html">TQObject</a> * receiver, const char * member )
|
||
13 years ago
|
</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>().
|
||
|
|
||
13 years ago
|
<h3 class=fn>bool <a name="eventFilter"></a>TQAccel::eventFilter ( <a href="ntqobject.html">TQObject</a> *, <a href="ntqevent.html">TQEvent</a> * )<tt> [virtual protected]</tt>
|
||
13 years ago
|
</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
|
||
13 years ago
|
<p>Reimplemented from <a href="ntqobject.html#eventFilter">TQObject</a>.
|
||
|
<h3 class=fn>int <a name="findKey"></a>TQAccel::findKey ( const <a href="ntqkeysequence.html">TQKeySequence</a> & key ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns the identifier of the accelerator item with the key code
|
||
|
<em>key</em>, or -1 if the item cannot be found.
|
||
|
|
||
13 years ago
|
<h3 class=fn>int <a name="insertItem"></a>TQAccel::insertItem ( const <a href="ntqkeysequence.html">TQKeySequence</a> & key, int id = -1 )
|
||
13 years ago
|
</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>
|
||
|
TQAccel *a = new TQAccel( myWindow ); // create accels for myWindow
|
||
|
a-><a href="#insertItem">insertItem</a>( CTRL + Key_P, 200 ); // Ctrl+P, e.g. to print document
|
||
13 years ago
|
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
|
||
13 years ago
|
a-><a href="#insertItem">insertItem</a>( <a href="ntqt.html#Key-enum">Key_D</a> ); // gets a unique negative id < -1
|
||
13 years ago
|
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>TQAccel::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>TQAccel::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>().
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqkeysequence.html">TQKeySequence</a> <a name="key"></a>TQAccel::key ( int id )
|
||
13 years ago
|
</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.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="keyToString"></a>TQAccel::keyToString ( <a href="ntqkeysequence.html">TQKeySequence</a> k )<tt> [static]</tt>
|
||
13 years ago
|
</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.
|
||
13 years ago
|
are translated (using <a href="ntqobject.html#tr">TQObject::tr</a>()) in the "TQAccel" context.
|
||
|
<p> The function is superfluous. Cast the <a href="ntqkeysequence.html">TQKeySequence</a> <em>k</em> to a
|
||
|
<a href="ntqstring.html">TQString</a> for the same effect.
|
||
13 years ago
|
|
||
|
<h3 class=fn>void <a name="removeItem"></a>TQAccel::removeItem ( int id )
|
||
|
</h3>
|
||
|
Removes the accelerator item with the identifier <em>id</em>.
|
||
|
|
||
|
<h3 class=fn>void <a name="repairEventFilter"></a>TQAccel::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>TQAccel::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 TQAccel.
|
||
|
<p> <p>See also <a href="#isEnabled">isEnabled</a>() and <a href="#setItemEnabled">setItemEnabled</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="setItemEnabled"></a>TQAccel::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 TQAccel.
|
||
|
<p> <p>See also <a href="#isItemEnabled">isItemEnabled</a>() and <a href="#isEnabled">isEnabled</a>().
|
||
|
|
||
13 years ago
|
<h3 class=fn>void <a name="setWhatsThis"></a>TQAccel::setWhatsThis ( int id, const <a href="ntqstring.html">TQString</a> & text )
|
||
13 years ago
|
</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
|
||
13 years ago
|
accelerator key), use <a href="ntqmenudata.html#setWhatsThis">TQMenuData::setWhatsThis</a>().
|
||
|
<p> <p>See also <a href="#whatsThis">whatsThis</a>(), <a href="ntqwhatsthis.html#inWhatsThisMode">TQWhatsThis::inWhatsThisMode</a>(), <a href="ntqmenudata.html#setWhatsThis">TQMenuData::setWhatsThis</a>(), and <a href="ntqaction.html#whatsThis-prop">TQAction::whatsThis</a>.
|
||
13 years ago
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqkeysequence.html">TQKeySequence</a> <a name="shortcutKey"></a>TQAccel::shortcutKey ( const <a href="ntqstring.html">TQString</a> & str )<tt> [static]</tt>
|
||
13 years ago
|
</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 TQt namespace class,
|
||
|
you must write e.g. TQt::ALT+TQt::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.
|
||
|
|
||
13 years ago
|
<h3 class=fn><a href="ntqkeysequence.html">TQKeySequence</a> <a name="stringToKey"></a>TQAccel::stringToKey ( const <a href="ntqstring.html">TQString</a> & s )<tt> [static]</tt>
|
||
13 years ago
|
</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
|
||
13 years ago
|
equivalents in the "TQAccel" context (using <a href="ntqobject.html#tr">TQObject::tr</a>()). Returns 0
|
||
13 years ago
|
if <em>s</em> is not recognized.
|
||
13 years ago
|
<p> This function is typically used with <a href="ntqobject.html#tr">tr</a>(), so that accelerator keys can be replaced in
|
||
13 years ago
|
translations:
|
||
|
<p> <pre>
|
||
13 years ago
|
<a href="ntqpopupmenu.html">TQPopupMenu</a> *file = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this );
|
||
|
file-><a href="ntqmenudata.html#insertItem">insertItem</a>( p1, tr("&Open..."), this, SLOT(open()),
|
||
|
TQAccel::<a href="#stringToKey">stringToKey</a>(<a href="ntqobject.html#tr">tr</a>("Ctrl+O", "File|Open")) );
|
||
13 years ago
|
</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.
|
||
13 years ago
|
<p> The function is superfluous. Construct a <a href="ntqkeysequence.html">TQKeySequence</a> from the
|
||
13 years ago
|
string <em>s</em> for the same effect.
|
||
13 years ago
|
<p> <p>See also <a href="ntqobject.html#tr">TQObject::tr</a>() and <a href="i18n.html">Internationalization with TQt</a>.
|
||
13 years ago
|
|
||
|
<p>Example: <a href="i18n-example.html#x1921">i18n/mywidget.cpp</a>.
|
||
13 years ago
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="whatsThis"></a>TQAccel::whatsThis ( int id ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns the What's This help text for the specified item <em>id</em> or
|
||
13 years ago
|
<a href="ntqstring.html#TQString-null">TQString::null</a> if no text has been specified.
|
||
13 years ago
|
<p> <p>See also <a href="#setWhatsThis">setWhatsThis</a>().
|
||
|
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">TQt 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>TQt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|