/usr/share/qt3/doc/html/qtooltip.html is in qt3-doc 3:3.3.8-b-8ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | <!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/widgets/qtooltip.cpp:643 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QToolTip 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>QToolTip Class Reference</h1>
<p>The QToolTip class provides tool tips (balloon help) for
any widget or rectangular part of a widget.
<a href="#details">More...</a>
<p><tt>#include <<a href="qtooltip-h.html">qtooltip.h</a>></tt>
<p>Inherits <a href="qt.html">Qt</a>.
<p><a href="qtooltip-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QToolTip"><b>QToolTip</b></a> ( QWidget * widget, QToolTipGroup * group = 0 )</li>
<li class=fn>QWidget * <a href="#parentWidget"><b>parentWidget</b></a> () const</li>
<li class=fn>QToolTipGroup * <a href="#group"><b>group</b></a> () const</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>void <a href="#add"><b>add</b></a> ( QWidget * widget, const QString & text )</li>
<li class=fn>void <a href="#add-2"><b>add</b></a> ( QWidget * widget, const QString & text, QToolTipGroup * group, const QString & longText )</li>
<li class=fn>void <a href="#remove"><b>remove</b></a> ( QWidget * widget )</li>
<li class=fn>void <a href="#add-3"><b>add</b></a> ( QWidget * widget, const QRect & rect, const QString & text )</li>
<li class=fn>void <a href="#add-4"><b>add</b></a> ( QWidget * widget, const QRect & rect, const QString & text, QToolTipGroup * group, const QString & groupText )</li>
<li class=fn>void <a href="#remove-2"><b>remove</b></a> ( QWidget * widget, const QRect & rect )</li>
<li class=fn>QString <a href="#textFor"><b>textFor</b></a> ( QWidget * widget, const QPoint & pos = QPoint ( ) )</li>
<li class=fn>void <a href="#hide"><b>hide</b></a> ()</li>
<li class=fn>QFont <a href="#font"><b>font</b></a> ()</li>
<li class=fn>void <a href="#setFont"><b>setFont</b></a> ( const QFont & font )</li>
<li class=fn>QPalette <a href="#palette"><b>palette</b></a> ()</li>
<li class=fn>void <a href="#setPalette"><b>setPalette</b></a> ( const QPalette & palette )</li>
<li class=fn>void setEnabled ( bool enable ) <em>(obsolete)</em></li>
<li class=fn>bool enabled () <em>(obsolete)</em></li>
<li class=fn>void <a href="#setGloballyEnabled"><b>setGloballyEnabled</b></a> ( bool enable )</li>
<li class=fn>bool <a href="#isGloballyEnabled"><b>isGloballyEnabled</b></a> ()</li>
<li class=fn>void <a href="#setWakeUpDelay"><b>setWakeUpDelay</b></a> ( int i )</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual void <a href="#maybeTip"><b>maybeTip</b></a> ( const QPoint & p ) = 0</li>
<li class=fn>void <a href="#tip"><b>tip</b></a> ( const QRect & rect, const QString & text )</li>
<li class=fn>void <a href="#tip-2"><b>tip</b></a> ( const QRect & rect, const QString & text, const QString & groupText )</li>
<li class=fn>void <a href="#tip-3"><b>tip</b></a> ( const QRect & rect, const QString & text, const QRect & geometry )</li>
<li class=fn>void <a href="#tip-4"><b>tip</b></a> ( const QRect & rect, const QString & text, const QString & groupText, const QRect & geometry )</li>
<li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QToolTip class provides tool tips (balloon help) for
any widget or rectangular part of a widget.
<p>
<p> The tip is a short, single line of text reminding the user of the
widget's or rectangle's function. It is drawn immediately below
the region in a distinctive black-on-yellow combination.
<p> The tip can be any Rich-Text formatted string.
<p> <a href="qtooltipgroup.html">QToolTipGroup</a> provides a way for tool tips to display another text
elsewhere (most often in a <a href="qstatusbar.html">status bar</a>).
<p> At any point in time, QToolTip is either dormant or active. In
dormant mode the tips are not shown and in active mode they are.
The mode is global, not particular to any one widget.
<p> QToolTip switches from dormant to active mode when the user hovers
the mouse on a tip-equipped region for a second or so and remains
active until the user either clicks a mouse button, presses a key,
lets the mouse hover for five seconds or moves the mouse outside
<em>all</em> tip-equipped regions for at least a second.
<p> The QToolTip class can be used in three different ways:
<ol type=1>
<li> Adding a tip to an entire widget.
<li> Adding a tip to a fixed rectangle within a widget.
<li> Adding a tip to a dynamic rectangle within a widget.
</ol>
<p> To add a tip to a widget, call the <em>static</em> function
<a href="#add">QToolTip::add</a>() with the widget and tip as arguments:
<p> <pre>
QToolTip::<a href="#add">add</a>( quitButton, "Leave the application" );
</pre>
<p> This is the simplest and most common use of QToolTip. The tip
will be deleted automatically when <em>quitButton</em> is deleted, but
you can remove it yourself, too:
<p> <pre>
QToolTip::<a href="#remove">remove</a>( quitButton );
</pre>
<p> You can also display another text (typically in a <a href="qstatusbar.html">status bar),</a> courtesy of <a href="qtooltipgroup.html">QToolTipGroup</a>. This example
assumes that <em>grp</em> is a <tt>QToolTipGroup *</tt> and is already
connected to the appropriate status bar:
<p> <pre>
QToolTip::<a href="#add">add</a>( quitButton, "Leave the application", grp,
"Leave the application, prompting to save if necessary" );
QToolTip::<a href="#add">add</a>( closeButton, "Close this window", grp,
"Close this window, prompting to save if necessary" );
</pre>
<p> To add a tip to a fixed rectangle within a widget, call the static
function <a href="#add">QToolTip::add</a>() with the widget, rectangle and tip as
arguments. (See the <a href="tooltip-example.html">tooltip/tooltip.cpp</a> example.) Again, you
can supply a <tt>QToolTipGroup *</tt> and another text if you want.
<p> Both of these are one-liners and cover the majority of cases. The
third and most general way to use QToolTip requires you to
reimplement a pure virtual function to decide whether to pop up a
tool tip. The <a href="tooltip-example.html">tooltip/tooltip.cpp</a> example demonstrates this
too. This mode can be used to implement tips for text that can
move as the user scrolls, for example.
<p> To use QToolTip like this, you must subclass QToolTip and
reimplement <a href="#maybeTip">maybeTip</a>(). QToolTip calls maybeTip() when a tip
should pop up, and maybeTip() decides whether to show a tip.
<p> Tool tips can be globally disabled using
<a href="#setGloballyEnabled">QToolTip::setGloballyEnabled</a>() or disabled in groups with
<a href="qtooltipgroup.html#setEnabled">QToolTipGroup::setEnabled</a>().
<p> You can retrieve the text of a tooltip for a given position within
a widget using <a href="#textFor">textFor</a>().
<p> The global tooltip font and palette can be set with the static
<a href="#setFont">setFont</a>() and <a href="#setPalette">setPalette</a>() functions respectively.
<p> <p>See also <a href="qstatusbar.html">QStatusBar</a>, <a href="qwhatsthis.html">QWhatsThis</a>, <a href="qtooltipgroup.html">QToolTipGroup</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Tool Tip</a>, and <a href="helpsystem.html">Help System</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QToolTip"></a>QToolTip::QToolTip ( <a href="qwidget.html">QWidget</a> * widget, <a href="qtooltipgroup.html">QToolTipGroup</a> * group = 0 )
</h3>
Constructs a tool tip object. This is only necessary if you need
tool tips on regions that can move within the widget (most often
because the widget's contents can scroll).
<p> <em>widget</em> is the widget you want to add dynamic tool tips to and
<em>group</em> (optional) is the tool tip group they should belong to.
<p> <b>Warning:</b> QToolTip is not a subclass of <a href="qobject.html">QObject</a>, so the instance of
QToolTip is not deleted when <em>widget</em> is deleted.
<p> <b>Warning:</b> If you delete the tool tip before you have deleted
<em>widget</em> then you need to make sure you call <a href="#remove">remove</a>() yourself from
<em>widget</em> in your reimplemented QToolTip destructor.
<p> <pre>
MyToolTip::~MyToolTip()
{
<a href="#remove">remove</a>( widget );
}
</pre>
<p> <p>See also <a href="#maybeTip">maybeTip</a>().
<h3 class=fn>void <a name="add"></a>QToolTip::add ( <a href="qwidget.html">QWidget</a> * widget, const <a href="qstring.html">QString</a> & text )<tt> [static]</tt>
</h3>
Adds a tool tip to <em>widget</em>. <em>text</em> is the text to be shown in
the tool tip.
<p> This is the most common entry point to the QToolTip class; it is
suitable for adding tool tips to buttons, checkboxes, comboboxes
and so on.
<p>Examples: <a href="helpsystem-example.html#x2695">helpsystem/mainwindow.cpp</a>, <a href="qdir-example.html#x1848">qdir/qdir.cpp</a>, <a href="scribble-example.html#x945">scribble/scribble.cpp</a>, and <a href="tooltip-example.html#x450">tooltip/tooltip.cpp</a>.
<h3 class=fn>void <a name="add-2"></a>QToolTip::add ( <a href="qwidget.html">QWidget</a> * widget, const <a href="qstring.html">QString</a> & text, <a href="qtooltipgroup.html">QToolTipGroup</a> * group, const <a href="qstring.html">QString</a> & longText )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Adds a tool tip to <em>widget</em> and to tool tip group <em>group</em>.
<p> <em>text</em> is the text shown in the tool tip and <em>longText</em> is the
text emitted from <em>group</em>.
<p> Normally, <em>longText</em> is shown in a <a href="qstatusbar.html">status
bar</a> or similar.
<h3 class=fn>void <a name="add-3"></a>QToolTip::add ( <a href="qwidget.html">QWidget</a> * widget, const <a href="qrect.html">QRect</a> & rect, const <a href="qstring.html">QString</a> & text )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Adds a tool tip to a fixed rectangle, <em>rect</em>, within <em>widget</em>.
<em>text</em> is the text shown in the tool tip.
<h3 class=fn>void <a name="add-4"></a>QToolTip::add ( <a href="qwidget.html">QWidget</a> * widget, const <a href="qrect.html">QRect</a> & rect, const <a href="qstring.html">QString</a> & text, <a href="qtooltipgroup.html">QToolTipGroup</a> * group, const <a href="qstring.html">QString</a> & groupText )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Adds a tool tip to an entire <em>widget</em> and to tool tip group <em>group</em>. The tooltip will disappear when the mouse leaves the <em>rect</em>.
<p> <em>text</em> is the text shown in the tool tip and <em>groupText</em> is the
text emitted from <em>group</em>.
<p> Normally, <em>groupText</em> is shown in a <a href="qstatusbar.html">status
bar</a> or similar.
<h3 class=fn>void <a name="clear"></a>QToolTip::clear ()<tt> [protected]</tt>
</h3>
Immediately removes all tool tips for this tooltip's parent
widget.
<h3 class=fn>bool <a name="enabled"></a>QToolTip::enabled ()<tt> [static]</tt>
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
<h3 class=fn><a href="qfont.html">QFont</a> <a name="font"></a>QToolTip::font ()<tt> [static]</tt>
</h3>
Returns the font common to all tool tips.
<p> <p>See also <a href="#setFont">setFont</a>().
<h3 class=fn><a href="qtooltipgroup.html">QToolTipGroup</a> * <a name="group"></a>QToolTip::group () const
</h3>
<p> Returns the tool tip group this QToolTip is a member of or 0 if it
isn't a member of any group.
<p> The tool tip group is the object responsible for maintaining
contact between tool tips and a <a href="qstatusbar.html">status
bar</a> or something else which can show the longer help text.
<p> <p>See also <a href="#parentWidget">parentWidget</a>() and <a href="qtooltipgroup.html">QToolTipGroup</a>.
<h3 class=fn>void <a name="hide"></a>QToolTip::hide ()<tt> [static]</tt>
</h3>
Hides any tip that is currently being shown.
<p> Normally, there is no need to call this function; QToolTip takes
care of showing and hiding the tips as the user moves the mouse.
<h3 class=fn>bool <a name="isGloballyEnabled"></a>QToolTip::isGloballyEnabled ()<tt> [static]</tt>
</h3>
Returns whether tool tips are enabled globally.
<p> <p>See also <a href="#setGloballyEnabled">setGloballyEnabled</a>().
<h3 class=fn>void <a name="maybeTip"></a>QToolTip::maybeTip ( const <a href="qpoint.html">QPoint</a> & p )<tt> [pure virtual protected]</tt>
</h3>
<p> This pure virtual function is half of the most versatile interface
QToolTip offers.
<p> It is called when there is a possibility that a tool tip should be
shown and must decide whether there is a tool tip for the point <em>p</em> in the widget that this QToolTip object relates to. If so,
<a href="#maybeTip">maybeTip</a>() must call <a href="#tip">tip</a>() with the rectangle the tip applies to,
the tip's text and optionally the <a href="qtooltipgroup.html">QToolTipGroup</a> details and the
geometry in screen coordinates.
<p> <em>p</em> is given in that widget's local coordinates. Most maybeTip()
implementations will be of the form:
<p> <pre>
if ( <something> ) {
<a href="#tip">tip</a>( <something>, <something> );
}
</pre>
<p> The first argument to tip() (a rectangle) must encompass <em>p</em>,
i.e. the tip must apply to the current mouse position; otherwise
QToolTip's operation is undefined.
<p> Note that the tip will disappear once the mouse moves outside the
rectangle you give to tip(), and will not reappear if the mouse
moves back in: maybeTip() is called again instead.
<p> <p>See also <a href="#tip">tip</a>().
<p>Examples: <a href="helpsystem-example.html#x2684">helpsystem/tooltip.cpp</a> and <a href="tooltip-example.html#x451">tooltip/tooltip.cpp</a>.
<h3 class=fn><a href="qpalette.html">QPalette</a> <a name="palette"></a>QToolTip::palette ()<tt> [static]</tt>
</h3>
Returns the palette common to all tool tips.
<p> <p>See also <a href="#setPalette">setPalette</a>().
<h3 class=fn><a href="qwidget.html">QWidget</a> * <a name="parentWidget"></a>QToolTip::parentWidget () const
</h3>
<p> Returns the widget this QToolTip applies to.
<p> The tool tip is destroyed automatically when the parent widget is
destroyed.
<p> <p>See also <a href="#group">group</a>().
<h3 class=fn>void <a name="remove"></a>QToolTip::remove ( <a href="qwidget.html">QWidget</a> * widget )<tt> [static]</tt>
</h3>
Removes the tool tip from <em>widget</em>.
<p> If there is more than one tool tip on <em>widget</em>, only the one
covering the entire widget is removed.
<h3 class=fn>void <a name="remove-2"></a>QToolTip::remove ( <a href="qwidget.html">QWidget</a> * widget, const <a href="qrect.html">QRect</a> & rect )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Removes any tool tip for <em>rect</em> from <em>widget</em>.
<p> If there is more than one tool tip on <em>widget</em>, only the one
covering rectangle <em>rect</em> is removed.
<h3 class=fn>void <a name="setEnabled"></a>QToolTip::setEnabled ( bool enable )<tt> [static]</tt>
</h3>
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
<h3 class=fn>void <a name="setFont"></a>QToolTip::setFont ( const <a href="qfont.html">QFont</a> & font )<tt> [static]</tt>
</h3>
Sets the font for all tool tips to <em>font</em>.
<p> <p>See also <a href="#font">font</a>().
<h3 class=fn>void <a name="setGloballyEnabled"></a>QToolTip::setGloballyEnabled ( bool enable )<tt> [static]</tt>
</h3>
If <em>enable</em> is TRUE sets all tool tips to be enabled (shown when
needed); if <em>enable</em> is FALSE sets all tool tips to be disabled
(never shown).
<p> By default, tool tips are enabled. Note that this function affects
all tool tips in the entire application.
<p> <p>See also <a href="qtooltipgroup.html#enabled-prop">QToolTipGroup::enabled</a>.
<h3 class=fn>void <a name="setPalette"></a>QToolTip::setPalette ( const <a href="qpalette.html">QPalette</a> & palette )<tt> [static]</tt>
</h3>
Sets the palette for all tool tips to <em>palette</em>.
<p> <p>See also <a href="#palette">palette</a>().
<h3 class=fn>void <a name="setWakeUpDelay"></a>QToolTip::setWakeUpDelay ( int i )<tt> [static]</tt>
</h3>
Sets the wakeup delay for all tooltips to <em>i</em>
milliseconds.
<h3 class=fn><a href="qstring.html">QString</a> <a name="textFor"></a>QToolTip::textFor ( <a href="qwidget.html">QWidget</a> * widget, const <a href="qpoint.html">QPoint</a> & pos = QPoint ( ) )<tt> [static]</tt>
</h3>
Returns the tool tip text for <em>widget</em> at position <em>pos</em>, or
<a href="qstring.html#QString-null">QString::null</a> if there is no tool tip for the given widget and
position.
<h3 class=fn>void <a name="tip"></a>QToolTip::tip ( const <a href="qrect.html">QRect</a> & rect, const <a href="qstring.html">QString</a> & text )<tt> [protected]</tt>
</h3>
Immediately pops up a tip saying <em>text</em> and removes the tip once
the cursor moves out of rectangle <em>rect</em> (which is given in the
coordinate system of the widget this QToolTip relates to).
<p> The tip will not reappear if the cursor moves back; your
<a href="#maybeTip">maybeTip</a>() must reinstate it each time.
<h3 class=fn>void <a name="tip-2"></a>QToolTip::tip ( const <a href="qrect.html">QRect</a> & rect, const <a href="qstring.html">QString</a> & text, const <a href="qstring.html">QString</a> & groupText )<tt> [protected]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Immediately pops up a tip saying <em>text</em> and removes that tip once
the cursor moves out of rectangle <em>rect</em> (which is given in the
coordinate system of the widget this QToolTip relates to). <em>groupText</em> is the text emitted from the group.
<p> The tip will not reappear if the cursor moves back; your
<a href="#maybeTip">maybeTip</a>() must reinstate it each time.
<h3 class=fn>void <a name="tip-3"></a>QToolTip::tip ( const <a href="qrect.html">QRect</a> & rect, const <a href="qstring.html">QString</a> & text, const <a href="qrect.html">QRect</a> & geometry )<tt> [protected]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Immediately pops up a tip within the rectangle <em>geometry</em>, saying
<em>text</em> and removes the tip once the cursor moves out of rectangle
<em>rect</em>. Both rectangles are given in the coordinate system of the
widget this QToolTip relates to.
<p> The tip will not reappear if the cursor moves back; your
<a href="#maybeTip">maybeTip</a>() must reinstate it each time.
<p> If the tip does not fit inside <em>geometry</em>, the tip expands.
<h3 class=fn>void <a name="tip-4"></a>QToolTip::tip ( const <a href="qrect.html">QRect</a> & rect, const <a href="qstring.html">QString</a> & text, const <a href="qstring.html">QString</a> & groupText, const <a href="qrect.html">QRect</a> & geometry )<tt> [protected]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Immediately pops up a tip within the rectangle <em>geometry</em>, saying
<em>text</em> and removes the tip once the cursor moves out of rectangle
<em>rect</em>. <em>groupText</em> is the text emitted from the group. Both
rectangles are given in the coordinate system of the widget this
QToolTip relates to.
<p> The tip will not reappear if the cursor moves back; your
<a href="#maybeTip">maybeTip</a>() must reinstate it each time.
<p> If the tip does not fit inside <em>geometry</em>, the tip expands.
<!-- 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>
|