1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QWhatsThis Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QWhatsThis Class Reference</h1><br clear="all">
<p>
The QWhatsThis class provides a simple description of any widget, e.g. answering the question "what's this?"
<a href="#details">More...</a>
<p>
<code>#include <<a href="qwhatsthis-h.html">qwhatsthis.h</a>></code>
<p>
Inherits <a href="qt.html">Qt</a>.
<p><a href="qwhatsthis-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#16917d"><b>QWhatsThis</b></a>(QWidget*)</div>
<li><div class="fn">virtual<a href="#ffbab1"><b>~QWhatsThis</b></a>()</div>
<li><div class="fn">virtualQString<a href="#da18b4"><b>text</b></a>(constQPoint&)</div>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class="fn">void<a href="#dfcd18"><b>add</b></a>(QWidget*, constQString&)</div>
<li><div class="fn">void<a href="#fbed6b"><b>remove</b></a>(QWidget*)</div>
<li><div class="fn">QString<a href="#86bab0"><b>textFor</b></a>(QWidget*, constQPoint&pos=QPoint())</div>
<li><div class="fn">QToolButton*<a href="#eb09a2"><b>whatsThisButton</b></a>(QWidget*parent)</div>
<li><div class="fn">void<a href="#db29e1"><b>enterWhatsThisMode</b></a>()</div>
<li><div class="fn">bool<a href="#592093"><b>inWhatsThisMode</b></a>()</div>
<li><div class="fn">void<a href="#d31af1"><b>leaveWhatsThisMode</b></a>(constQString&=QString::null, constQPoint&pos=QCursor::pos())</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QWhatsThis class provides a simple description of any widget, e.g. answering the question "what's this?"
<p>
<i>What's This</i> help is part of an application's
<a href=helpsystem.html>online help systems</a>,
offering users a level of detail between
tool tips and full text browsing windows.
<p>QWhatsThis provides a single window with a single explanatory
text, which pops up quickly when the user asks "what's this?", and
goes away as soon as the user does something else.
<p>To assign <i>What's This?</i> text to a widget, you simply
call <a href="#dfcd18">QWhatsThis::add</a>() for the widget. To assign text to a
menu item, call <a href="qmenudata.html#88eb55">QMenuData::setWhatsThis</a>(), and for a global
accelerator key, call <a href="qaccel.html#ce02d6">QAccel::setWhatsThis</a>().
<p>The text can be either rich text or plain text. If you
specify a rich text formatted string, it will be rendered using the
default stylesheet. This makes it also possible to embed images. See
<a href="qstylesheet.html#50ded7">QStyleSheet::defaultSheet</a>() for details.
<p>By default, the user will be able to view the text for a widget
by pressing Shift-F1 while the widget has focus.
On window systems where a context help button is provided in
the window decorations, that button enters <i>What's This?</i> mode.
In this mode, if the user
clicks on a widget, help will be given for the widget. The mode
is left when help is given or when the user presses the Escape key.
<p>An alternative way to enter <i>What's This?</i> mode is
to use the ready-made toolbar tool button from
<a href="#eb09a2">QWhatsThis::whatsThisButton</a>().
If you are using <a href="qmainwindow.html">QMainWindow</a>, you can also use
the <a href="qmainwindow.html#f50ce2">QMainWindow::whatsThis</a>() slot to invoke the mode from a menu item.
<p><img src="whatsthis.png" width="284" height="246">
<p>For more control, you can create a dedicated QWhatsThis object for a
special widget. By subclassing and reimplementing <a href="#da18b4">QWhatsThis::text</a>()
it is possible to have different explanatory texts depending on the
position of the mouse click.
<p>If your widget needs even more control, see
<a href="qwidget.html#eeb880">QWidget::customWhatsThis</a>().
<p>To remove added text, you can use <a href="#fbed6b">QWhatsThis::remove</a>(), but since
the text is automatically removed when the widget is destroyed,
this is rarely needed.
<p>See also <a href="qtooltip.html">QToolTip</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="16917d"></a>QWhatsThis::QWhatsThis(<a href="qwidget.html">QWidget</a>*widget)</h3>
<p>Constructs a dynamic <i>What's This</i> object for <em>widget.</em>
<p>When the widget is queried by the user, the <a href="#da18b4">text</a>() function of
this QWhatsThis will be called to provide the appropriate text,
rather than using text assigned by <a href="#dfcd18">add</a>().
<h3 class="fn"><a name="ffbab1"></a>QWhatsThis::~QWhatsThis() <code>[virtual]</code></h3>
<p>Destructs the object and frees any allocated resources.
<h3 class="fn">void<a name="dfcd18"></a>QWhatsThis::add(<a href="qwidget.html">QWidget</a>*widget, const<a href="qstring.html">QString</a>&text) <code>[static]</code></h3>
<p>Adds <em>text</em> as <i>What's This</i> help for <em>widget.</em> If the text is rich
text formatted (ie. it contains markup), it will be rendered with
the default stylesheet <a href="qstylesheet.html#50ded7">QStyleSheet::defaultSheet</a>().
<p>The text is destroyed if the widget is later destroyed and so need
not be explicitly removed.
<p>See also <a href="#fbed6b">remove</a>().
<h3 class="fn">void<a name="db29e1"></a>QWhatsThis::enterWhatsThisMode() <code>[static]</code></h3>
<p>Enters <i>What's This</i>? mode and returns immediately.
<p>Qt will install a special cursor and take over mouse input
until the user clicks somewhere, then show any help available and
switch out of <i>What's This</i> mode. Finally, Qt
removes the special cursor and help window then restores ordinary event
processing, at which point the left mouse button is not pressed.
<p>The user can also use the Escape key to leave <i>What's This</i>? mode.
<p>See also <a href="#592093">inWhatsThisMode</a>() and <a href="#d31af1">leaveWhatsThisMode</a>().
<h3 class="fn">bool<a name="592093"></a>QWhatsThis::inWhatsThisMode() <code>[static]</code></h3>
<p>Returns whether the application is in <i>What's This</i> mode.
<p>See also <a href="#db29e1">enterWhatsThisMode</a>() and <a href="#d31af1">leaveWhatsThisMode</a>().
<h3 class="fn">void<a name="d31af1"></a>QWhatsThis::leaveWhatsThisMode(const<a href="qstring.html">QString</a>&text=QString::null, const<a href="qpoint.html">QPoint</a>&pos=QCursor::pos()) <code>[static]</code></h3>
<p>Leaves <i>What's This</i>? question mode
<p>This function is used internally by widgets that support
<a href="qwidget.html#eeb880">QWidget::customWhatsThis</a>(), applications do not usually call
it. An example for such a kind of widget is QPopupMenu: Menus still
work normally in <i>What's This</i> mode, but provide help texts for single
menu items instead.
<p>If <em>text</em> is not a null string, then a <i>What's This</i> help window is
displayed at the global screen position <em>pos.</em>
<p>See also <a href="#592093">inWhatsThisMode</a>() and <a href="#db29e1">enterWhatsThisMode</a>().
<h3 class="fn">void<a name="fbed6b"></a>QWhatsThis::remove(<a href="qwidget.html">QWidget</a>*widget) <code>[static]</code></h3>
<p>Removes the <i>What's This</i> help for <em>widget.</em> This happens
automatically if the widget is destroyed.
<p>See also <a href="#dfcd18">add</a>().
<h3 class="fn"><a href="qstring.html">QString</a><a name="da18b4"></a>QWhatsThis::text(const<a href="qpoint.html">QPoint</a>&) <code>[virtual]</code></h3>
<p>This virtual functions returns the text for position <em>p</em> in the
widget that this <i>What's This</i> object documents. If there is no
<i>What's This</i> text for a position, QString::null is returned.
<p>The default implementation returns QString::null.
<h3 class="fn"><a href="qstring.html">QString</a><a name="86bab0"></a>QWhatsThis::textFor(<a href="qwidget.html">QWidget</a>*widget, const<a href="qpoint.html">QPoint</a>&pos=QPoint()) <code>[static]</code></h3>
<p>Returns the text for <em>widget,</em> or a null string if there
is no <i>What's This</i> help for <em>widget.</em>
<p>See also <a href="#dfcd18">add</a>().
<h3 class="fn"><a href="qtoolbutton.html">QToolButton</a>*<a name="eb09a2"></a>QWhatsThis::whatsThisButton(<a href="qwidget.html">QWidget</a>*parent) <code>[static]</code></h3>
<p>Creates a <a href="qtoolbutton.html">QToolButton</a> pre-configured
to enter <i>What's This</i> mode when clicked. You
will often use this with a toolbar:
<pre> (void)QWhatsThis::whatsThisButton( my_help_tool_bar );
</pre>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|