qtooltip.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 328 行 · 第 1/2 页
HTML
328 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/widgets/qtooltip.cpp:609 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QToolTip 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: #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 anywidget 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><div class=fn><a href="#QToolTip"><b>QToolTip</b></a> ( QWidget * widget, QToolTipGroup * group = 0 )</div></li><li><div class=fn>QWidget * <a href="#parentWidget"><b>parentWidget</b></a> () const</div></li><li><div class=fn>QToolTipGroup * <a href="#group"><b>group</b></a> () const</div></li></ul><h2>Static Public Members</h2><ul><li><div class=fn>void <a href="#add"><b>add</b></a> ( QWidget * widget, const QString & text )</div></li><li><div class=fn>void <a href="#add-2"><b>add</b></a> ( QWidget * widget, const QString & text, QToolTipGroup * group, const QString & longText )</div></li><li><div class=fn>void <a href="#remove"><b>remove</b></a> ( QWidget * widget )</div></li><li><div class=fn>void <a href="#add-3"><b>add</b></a> ( QWidget * widget, const QRect & rect, const QString & text )</div></li><li><div class=fn>void <a href="#add-4"><b>add</b></a> ( QWidget * widget, const QRect & rect, const QString & text, QToolTipGroup * group, const QString & groupText )</div></li><li><div class=fn>void <a href="#remove-2"><b>remove</b></a> ( QWidget * widget, const QRect & rect )</div></li><li><div class=fn>QString <a href="#textFor"><b>textFor</b></a> ( QWidget * widget, const QPoint & pos = QPoint ( ) )</div></li><li><div class=fn>void <a href="#hide"><b>hide</b></a> ()</div></li><li><div class=fn>QFont <a href="#font"><b>font</b></a> ()</div></li><li><div class=fn>void <a href="#setFont"><b>setFont</b></a> ( const QFont & font )</div></li><li><div class=fn>QPalette <a href="#palette"><b>palette</b></a> ()</div></li><li><div class=fn>void <a href="#setPalette"><b>setPalette</b></a> ( const QPalette & palette )</div></li><li><div class=fn>void setEnabled ( bool enable ) <em>(obsolete)</em></div></li><li><div class=fn>bool enabled () <em>(obsolete)</em></div></li><li><div class=fn>void <a href="#setGloballyEnabled"><b>setGloballyEnabled</b></a> ( bool enable )</div></li><li><div class=fn>bool <a href="#isGloballyEnabled"><b>isGloballyEnabled</b></a> ()</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>virtual void <a href="#maybeTip"><b>maybeTip</b></a> ( const QPoint & p ) = 0</div></li><li><div class=fn>void <a href="#tip"><b>tip</b></a> ( const QRect & rect, const QString & text )</div></li><li><div class=fn>void <a href="#tip-2"><b>tip</b></a> ( const QRect & rect, const QString & text, const QString & groupText )</div></li><li><div class=fn>void <a href="#clear"><b>clear</b></a> ()</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QToolTip class provides tool tips (balloon help) for anywidget or rectangular part of a widget.<p> <p> The tip is a short, single line of text reminding the user of the widget'sor rectangle's function. It is drawn immediately below the regionin a distinctive black-on-yellow combination.<p> <a href="qtooltipgroup.html">QToolTipGroup</a> provides a way for tool tips to display another textelsewhere (most often in a status bar).<p> At any point in time, QToolTip is either dormant or active. Indormant 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 themouse on a tip-equipped region for a second or so and remainsactive until the user either clicks a mouse button, pressesa key, lets the mouse hover for five seconds or moves the mouseoutside <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 willbe deleted automatically when <em>quitButton</em> is deleted, but you canremove 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 exampleassumes that <em>g</em> is a <tt>QToolTipGroup *</tt> and is alreadyconnected to the appropriate status bar:<p> <pre> QToolTip::<a href="#add">add</a>( quitButton, "Leave the application", g, "Leave the application, prompting to save if necessary" ); QToolTip::<a href="#add">add</a>( closeButton, "Close this window", g, "Close this window, prompting to save if necessary" ); </pre> <p> To add a tip to a fixed rectangle within a widget, call the staticfunction <a href="#add">QToolTip::add</a>() with the widget, rectangle and tip asarguments. (See the tooltip/tooltip.cpp 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 ofcases. The third and most general way to use QToolTip requires youto reimplement a pure virtual function to decide whether to pop up atool tip. The tooltip/tooltip.cpp example demonstrates this too.This mode can be used to implement tips for text that can move as theuser scrolls, for example.<p> To use QToolTip like this, you need to subclass QToolTip and reimplement<a href="#maybeTip">maybeTip</a>(). QToolTip calls maybeTip() when a tip should pop up, andmaybeTip decides whether to show a tip.<p> Tool tips can be globally disabled using <a href="#setGloballyEnabled">QToolTip::setGloballyEnabled</a>() ordisabled in groups with <a href="qtooltipgroup.html#setEnabled">QToolTipGroup::setEnabled</a>().<p> You can retreive the text of a tooltip for a given position within awidget 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 necessary only if you needtool tips on regions that can move within the widget (most oftenbecause 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 ofQToolTip is not deleted when <em>widget</em> is deleted.<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 inthe tool tip.<p> This is the most common entry point to the QToolTip class; it issuitable for adding tool tips to buttons, check boxes, combo boxesand so on.<p>Examples: <a href="qdir-example.html#x1841">qdir/qdir.cpp</a>, <a href="scribble-example.html#x965">scribble/scribble.cpp</a> and <a href="tooltip-example.html#x569">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.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?