<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qtooltip.cpp --> <title>Qt 4.8: QToolTip Class Reference</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li><a href="modules.html">Modules</a></li> <li><a href="qtgui.html">QtGui</a></li> <li>QToolTip</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></li> </ul> </div> </div> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QToolTip Class Reference</h1> <!-- $$$QToolTip-brief --> <p>The QToolTip class provides tool tips (balloon help) for any widget. <a href="#details">More...</a></p> <!-- @@@QToolTip --> <pre class="cpp"> <span class="preprocessor">#include <QToolTip></span></pre><ul> <li><a href="qtooltip-members.html">List of all members, including inherited members</a></li> <li><a href="qtooltip-qt3.html">Qt 3 support members</a></li> </ul> <a name="static-public-members"></a> <h2>Static Public Members</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> QFont </td><td class="memItemRight bottomAlign"><b><a href="qtooltip.html#font">font</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtooltip.html#hideText">hideText</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtooltip.html#isVisible">isVisible</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QPalette </td><td class="memItemRight bottomAlign"><b><a href="qtooltip.html#palette">palette</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtooltip.html#setFont">setFont</a></b> ( const QFont & <i>font</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtooltip.html#setPalette">setPalette</a></b> ( const QPalette & <i>palette</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtooltip.html#showText">showText</a></b> ( const QPoint & <i>pos</i>, const QString & <i>text</i>, QWidget * <i>w</i>, const QRect & <i>rect</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtooltip.html#showText-2">showText</a></b> ( const QPoint & <i>pos</i>, const QString & <i>text</i>, QWidget * <i>w</i> = 0 )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtooltip.html#text">text</a></b> ()</td></tr> </table> <a name="details"></a> <!-- $$$QToolTip-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The QToolTip class provides tool tips (balloon help) for any widget.</p> <p>The tip is a short piece of text reminding the user of the widget's function. It is drawn immediately below the given position in a distinctive black-on-yellow color combination. The tip can be any <a href="qtextedit.html">rich text</a> formatted string.</p> <p>Rich text displayed in a tool tip is implicitly word-wrapped unless specified differently with <tt><p style='white-space:pre'></tt>.</p> <p>The simplest and most common way to set a widget's tool tip is by calling its <a href="qwidget.html#toolTip-prop">QWidget::setToolTip</a>() function.</p> <p>It is also possible to show different tool tips for different regions of a widget, by using a <a href="qhelpevent.html">QHelpEvent</a> of type <a href="qevent.html#Type-enum">QEvent::ToolTip</a>. Intercept the help event in your widget's <a href="qwidget.html#event">event()</a> function and call <a href="qtooltip.html#showText">QToolTip::showText</a>() with the text you want to display. The <a href="widgets-tooltips.html">Tooltips</a> example illustrates this technique.</p> <p>If you are calling <a href="qtooltip.html#hideText">QToolTip::hideText</a>(), or <a href="qtooltip.html#showText">QToolTip::showText</a>() with an empty string, as a result of a <a href="qevent.html#Type-enum">ToolTip</a>-event you should also call <a href="qevent.html#ignore">ignore()</a> on the event, to signal that you don't want to start any tooltip specific modes.</p> <p>Note that, if you want to show tooltips in an item view, the model/view architecture provides functionality to set an item's tool tip; e.g., the <a href="qtablewidgetitem.html#setToolTip">QTableWidgetItem::setToolTip</a>() function. However, if you want to provide custom tool tips in an item view, you must intercept the help event in the <a href="qabstractitemview.html#viewportEvent">QAbstractItemView::viewportEvent</a>() function and handle it yourself.</p> <p>The default tool tip color and font can be customized with <a href="qtooltip.html#setPalette">setPalette</a>() and <a href="qtooltip.html#setFont">setFont</a>(). When a tooltip is currently on display, <a href="qtooltip.html#isVisible">isVisible</a>() returns true and <a href="qtooltip.html#text">text</a>() the currently visible text.</p> <p><b>Note:</b> Tool tips use the inactive color group of <a href="qpalette.html">QPalette</a>, because tool tips are not active windows.</p> </div> <p><b>See also </b><a href="qwidget.html#toolTip-prop">QWidget::toolTip</a>, <a href="qaction.html#toolTip-prop">QAction::toolTip</a>, and <a href="widgets-tooltips.html">Tool Tips Example</a>.</p> <!-- @@@QToolTip --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$font[overload1]$$$font --> <h3 class="fn"><a name="font"></a><span class="type"><a href="qfont.html">QFont</a></span> QToolTip::<span class="name">font</span> ()<tt> [static]</tt></h3> <p>Returns the font used to render tooltips.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also </b><a href="qtooltip.html#setFont">setFont</a>().</p> <!-- @@@font --> <!-- $$$hideText[overload1]$$$hideText --> <h3 class="fn"><a name="hideText"></a><span class="type">void</span> QToolTip::<span class="name">hideText</span> ()<tt> [static]</tt></h3> <p>Hides the tool tip. This is the same as calling <a href="qtooltip.html#showText">showText</a>() with an empty string.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also </b><a href="qtooltip.html#showText">showText</a>().</p> <!-- @@@hideText --> <!-- $$$isVisible[overload1]$$$isVisible --> <h3 class="fn"><a name="isVisible"></a><span class="type">bool</span> QToolTip::<span class="name">isVisible</span> ()<tt> [static]</tt></h3> <p>Returns true if this tooltip is currently shown.</p> <p>This function was introduced in Qt 4.4.</p> <p><b>See also </b><a href="qtooltip.html#showText">showText</a>().</p> <!-- @@@isVisible --> <!-- $$$palette[overload1]$$$palette --> <h3 class="fn"><a name="palette"></a><span class="type"><a href="qpalette.html">QPalette</a></span> QToolTip::<span class="name">palette</span> ()<tt> [static]</tt></h3> <p>Returns the palette used to render tooltips.</p> <p><b>Note:</b> Tool tips use the inactive color group of <a href="qpalette.html">QPalette</a>, because tool tips are not active windows.</p> <p><b>See also </b><a href="qtooltip.html#setPalette">setPalette</a>().</p> <!-- @@@palette --> <!-- $$$setFont[overload1]$$$setFontconstQFont& --> <h3 class="fn"><a name="setFont"></a><span class="type">void</span> QToolTip::<span class="name">setFont</span> ( const <span class="type"><a href="qfont.html">QFont</a></span> & <i>font</i> )<tt> [static]</tt></h3> <p>Sets the <i>font</i> used to render tooltips.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also </b><a href="qtooltip.html#font">font</a>().</p> <!-- @@@setFont --> <!-- $$$setPalette[overload1]$$$setPaletteconstQPalette& --> <h3 class="fn"><a name="setPalette"></a><span class="type">void</span> QToolTip::<span class="name">setPalette</span> ( const <span class="type"><a href="qpalette.html">QPalette</a></span> & <i>palette</i> )<tt> [static]</tt></h3> <p>Sets the <i>palette</i> used to render tooltips.</p> <p><b>Note:</b> Tool tips use the inactive color group of <a href="qpalette.html">QPalette</a>, because tool tips are not active windows.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also </b><a href="qtooltip.html#palette">palette</a>().</p> <!-- @@@setPalette --> <!-- $$$showText[overload1]$$$showTextconstQPoint&constQString&QWidget*constQRect& --> <h3 class="fn"><a name="showText"></a><span class="type">void</span> QToolTip::<span class="name">showText</span> ( const <span class="type"><a href="qpoint.html">QPoint</a></span> & <i>pos</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>w</i>, const <span class="type"><a href="qrect.html">QRect</a></span> & <i>rect</i> )<tt> [static]</tt></h3> <p>Shows <i>text</i> as a tool tip, with the global position <i>pos</i> as the point of interest. The tool tip will be shown with a platform specific offset from this point of interest.</p> <p>If you specify a non-empty rect the tip will be hidden as soon as you move your cursor out of this area.</p> <p>The <i>rect</i> is in the coordinates of the widget you specify with <i>w</i>. If the <i>rect</i> is not empty you must specify a widget. Otherwise this argument can be 0 but it is used to determine the appropriate screen on multi-head systems.</p> <p>If <i>text</i> is empty the tool tip is hidden. If the text is the same as the currently shown tooltip, the tip will <i>not</i> move. You can force moving by first hiding the tip with an empty text, and then showing the new tip at the new position.</p> <!-- @@@showText --> <!-- $$$showText$$$showTextconstQPoint&constQString&QWidget* --> <h3 class="fn"><a name="showText-2"></a><span class="type">void</span> QToolTip::<span class="name">showText</span> ( const <span class="type"><a href="qpoint.html">QPoint</a></span> & <i>pos</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>text</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>w</i> = 0 )<tt> [static]</tt></h3> <p>This is an overloaded function.</p> <p>This is analogous to calling QToolTip::showText(<i>pos</i>, <i>text</i>, <i>w</i>, QRect())</p> <!-- @@@showText --> <!-- $$$text[overload1]$$$text --> <h3 class="fn"><a name="text"></a><span class="type"><a href="qstring.html">QString</a></span> QToolTip::<span class="name">text</span> ()<tt> [static]</tt></h3> <p>Returns the tooltip text, if a tooltip is visible, or an empty string if a tooltip is not visible.</p> <p>This function was introduced in Qt 4.4.</p> <!-- @@@text --> </div> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its subsidiaries. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>