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.
240 lines
14 KiB
240 lines
14 KiB
<!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/qwhatsthis.cpp:61 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>QWhatsThis 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>QWhatsThis Class Reference</h1>
|
|
|
|
<p>The QWhatsThis class provides a simple description of any
|
|
widget, i.e. answering the question "What's this?".
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="qwhatsthis-h.html">qwhatsthis.h</a>></tt>
|
|
<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 class=fn><a href="#QWhatsThis"><b>QWhatsThis</b></a> ( QWidget * widget )</li>
|
|
<li class=fn>virtual <a href="#~QWhatsThis"><b>~QWhatsThis</b></a> ()</li>
|
|
<li class=fn>virtual QString <a href="#text"><b>text</b></a> ( const QPoint & )</li>
|
|
<li class=fn>virtual bool <a href="#clicked"><b>clicked</b></a> ( const QString & href )</li>
|
|
</ul>
|
|
<h2>Static Public Members</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#setFont"><b>setFont</b></a> ( const QFont & font )</li>
|
|
<li class=fn>void <a href="#add"><b>add</b></a> ( QWidget * widget, const QString & text )</li>
|
|
<li class=fn>void <a href="#remove"><b>remove</b></a> ( QWidget * widget )</li>
|
|
<li class=fn>QString <a href="#textFor"><b>textFor</b></a> ( QWidget * w, const QPoint & pos = QPoint ( ), bool includeParents = FALSE )</li>
|
|
<li class=fn>QToolButton * <a href="#whatsThisButton"><b>whatsThisButton</b></a> ( QWidget * parent )</li>
|
|
<li class=fn>void <a href="#enterWhatsThisMode"><b>enterWhatsThisMode</b></a> ()</li>
|
|
<li class=fn>bool <a href="#inWhatsThisMode"><b>inWhatsThisMode</b></a> ()</li>
|
|
<li class=fn>void <a href="#leaveWhatsThisMode"><b>leaveWhatsThisMode</b></a> ( const QString & text = QString::null, const QPoint & pos = QCursor::pos ( ), QWidget * w = 0 )</li>
|
|
<li class=fn>void <a href="#display"><b>display</b></a> ( const QString & text, const QPoint & pos = QCursor::pos ( ), QWidget * w = 0 )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The QWhatsThis class provides a simple description of any
|
|
widget, i.e. answering the question "What's this?".
|
|
<p>
|
|
|
|
<p> "What's this?" help is part of an application's online <a href="helpsystem.html#help-system">help system</a>
|
|
that provides users with information about functionality, usage,
|
|
background etc., in various levels of detail from short tool tips
|
|
to full text browsing help windows.
|
|
<p> QWhatsThis provides a single window with an explanatory text that
|
|
pops up when the user asks "What's this?". The default way to do
|
|
this is to focus the relevant widget and press Shift+F1. The help
|
|
text appears immediately; it goes away as soon as the user does
|
|
something else.
|
|
<p> (Note that if there is an accelerator for Shift+F1, this mechanism
|
|
will not work.)
|
|
<p> To add "What's this?" text to a widget you simply call
|
|
<a href="#add">QWhatsThis::add</a>() for the widget. For example, to assign text to a
|
|
menu item, call <a href="qmenudata.html#setWhatsThis">QMenuData::setWhatsThis</a>(); for a global
|
|
accelerator key, call <a href="qaccel.html#setWhatsThis">QAccel::setWhatsThis</a>() and If you're using
|
|
actions, use <a href="qaction.html#setWhatsThis">QAction::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 possible to embed images. See
|
|
<a href="qstylesheet.html#defaultSheet">QStyleSheet::defaultSheet</a>() for details.
|
|
<p>
|
|
|
|
<pre> const char * fileOpenText = "<p><img source=\"fileopen\"> "
|
|
"Click this button to open a <em>new file</em>. <br>"
|
|
"You can also select the <b>Open</b> command "
|
|
"from the <b>File</b> menu.</p>";
|
|
<a name="x2104"></a> QMimeSourceFactory::<a href="qmimesourcefactory.html#defaultFactory">defaultFactory</a>()->setPixmap( "document-open",
|
|
<a name="x2102"></a> fileOpenAction-><a href="qaction.html#iconSet">iconSet</a>().pixmap() );
|
|
<a name="x2103"></a> fileOpenAction-><a href="qaction.html#setWhatsThis">setWhatsThis</a>( fileOpenText );
|
|
</pre>
|
|
<p> An alternative way to enter "What's this?" mode is to use the
|
|
ready-made tool bar tool button from
|
|
<a href="#whatsThisButton">QWhatsThis::whatsThisButton</a>(). By invoking this context help
|
|
button (in the picture below the first one from the right) the
|
|
user switches into "What's this?" mode. If they now click on a
|
|
widget the appropriate help text is shown. The mode is left when
|
|
help is given or when the user presses Esc.
|
|
<p> <center><img src="whatsthis.png"></center>
|
|
<p> If you are using <a href="qmainwindow.html">QMainWindow</a> you can also use the
|
|
<a href="qmainwindow.html#whatsThis">QMainWindow::whatsThis</a>() slot to invoke the mode from a menu item.
|
|
<p> For more control you can create a dedicated QWhatsThis object for
|
|
a special widget. By subclassing and reimplementing
|
|
<a href="#text">QWhatsThis::text</a>() it is possible to have different help texts,
|
|
depending on the position of the mouse click. By reimplementing
|
|
<a href="#clicked">QWhatsThis::clicked</a>() it is possible to have hyperlinks inside the
|
|
help texts.
|
|
<p> If you wish to control the "What's this?" behavior of a widget
|
|
manually see <a href="qwidget.html#customWhatsThis">QWidget::customWhatsThis</a>().
|
|
<p> The What's This object can be removed using <a href="#remove">QWhatsThis::remove</a>(),
|
|
although this is rarely necessary because it is automatically
|
|
removed when the widget is destroyed.
|
|
<p> <p>See also <a href="qtooltip.html">QToolTip</a> and <a href="helpsystem.html">Help System</a>.
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="QWhatsThis"></a>QWhatsThis::QWhatsThis ( <a href="qwidget.html">QWidget</a> * widget )
|
|
</h3>
|
|
Constructs a dynamic "What's this?" object for <em>widget</em>. The
|
|
object is deleted when the <em>widget</em> is destroyed.
|
|
<p> When the widget is queried by the user the <a href="#text">text</a>() function of this
|
|
QWhatsThis will be called to provide the appropriate text, rather
|
|
than using the text assigned by <a href="#add">add</a>().
|
|
|
|
<h3 class=fn><a name="~QWhatsThis"></a>QWhatsThis::~QWhatsThis ()<tt> [virtual]</tt>
|
|
</h3>
|
|
Destroys the object and frees any allocated resources.
|
|
|
|
<h3 class=fn>void <a name="add"></a>QWhatsThis::add ( <a href="qwidget.html">QWidget</a> * widget, const <a href="qstring.html">QString</a> & text )<tt> [static]</tt>
|
|
</h3>
|
|
Adds <em>text</em> as "What's this" help for <em>widget</em>. If the text is
|
|
rich text formatted (i.e. it contains markup) it will be rendered
|
|
with the default stylesheet <a href="qstylesheet.html#defaultSheet">QStyleSheet::defaultSheet</a>().
|
|
<p> The text is destroyed if the widget is later destroyed, so it need
|
|
not be explicitly removed.
|
|
<p> <p>See also <a href="#remove">remove</a>().
|
|
|
|
<p>Examples: <a href="simple-application-example.html#x1591">application/application.cpp</a>, <a href="helpsystem-example.html#x2698">helpsystem/mainwindow.cpp</a>, and <a href="mdi-example.html#x2075">mdi/application.cpp</a>.
|
|
<h3 class=fn>bool <a name="clicked"></a>QWhatsThis::clicked ( const <a href="qstring.html">QString</a> & href )<tt> [virtual]</tt>
|
|
</h3>
|
|
|
|
<p> This virtual function is called when the user clicks inside the
|
|
"What's this?" window. <em>href</em> is the link the user clicked on, or
|
|
<a href="qstring.html#QString-null">QString::null</a> if there was no link.
|
|
<p> If the function returns TRUE (the default), the "What's this?"
|
|
window is closed, otherwise it remains visible.
|
|
<p> The default implementation ignores <em>href</em> and returns TRUE.
|
|
|
|
<h3 class=fn>void <a name="display"></a>QWhatsThis::display ( const <a href="qstring.html">QString</a> & text, const <a href="qpoint.html">QPoint</a> & pos = QCursor::pos ( ), <a href="qwidget.html">QWidget</a> * w = 0 )<tt> [static]</tt>
|
|
</h3>
|
|
Display <em>text</em> in a help window at the global screen position <em>pos</em>.
|
|
<p> If widget <em>w</em> is not 0 and has its own dedicated QWhatsThis
|
|
object, this object will receive <a href="#clicked">clicked</a>() messages when the user
|
|
clicks on hyperlinks inside the help text.
|
|
<p> <p>See also <a href="#clicked">QWhatsThis::clicked</a>().
|
|
|
|
<h3 class=fn>void <a name="enterWhatsThisMode"></a>QWhatsThis::enterWhatsThisMode ()<tt> [static]</tt>
|
|
</h3>
|
|
Enters "What's this?" mode and returns immediately.
|
|
<p> Qt will install a special cursor and take over mouse input until
|
|
the user clicks somewhere. It then shows any help available and
|
|
ends "What's this?" mode. Finally, Qt removes the special cursor
|
|
and help window and then restores ordinary event processing, at
|
|
which point the left mouse button is no longer pressed.
|
|
<p> The user can also use the Esc key to leave "What's this?" mode.
|
|
<p> <p>See also <a href="#inWhatsThisMode">inWhatsThisMode</a>() and <a href="#leaveWhatsThisMode">leaveWhatsThisMode</a>().
|
|
|
|
<h3 class=fn>bool <a name="inWhatsThisMode"></a>QWhatsThis::inWhatsThisMode ()<tt> [static]</tt>
|
|
</h3>
|
|
Returns TRUE if the application is in "What's this?" mode;
|
|
otherwise returns FALSE.
|
|
<p> <p>See also <a href="#enterWhatsThisMode">enterWhatsThisMode</a>() and <a href="#leaveWhatsThisMode">leaveWhatsThisMode</a>().
|
|
|
|
<h3 class=fn>void <a name="leaveWhatsThisMode"></a>QWhatsThis::leaveWhatsThisMode ( const <a href="qstring.html">QString</a> & text = QString::null, const <a href="qpoint.html">QPoint</a> & pos = QCursor::pos ( ), <a href="qwidget.html">QWidget</a> * w = 0 )<tt> [static]</tt>
|
|
</h3>
|
|
Leaves "What's this?" question mode.
|
|
<p> This function is used internally by widgets that support
|
|
<a href="qwidget.html#customWhatsThis">QWidget::customWhatsThis</a>(); applications do not usually call it.
|
|
An example of such a widget is QPopupMenu: menus still work
|
|
normally in "What's this?" mode but also provide help texts for
|
|
individual menu items.
|
|
<p> If <em>text</em> is not <a href="qstring.html#QString-null">QString::null</a>, a "What's this?" help window is
|
|
displayed at the global screen position <em>pos</em>. If widget <em>w</em> is
|
|
not 0 and has its own dedicated QWhatsThis object, this object
|
|
will receive <a href="#clicked">clicked</a>() messages when the user clicks on hyperlinks
|
|
inside the help text.
|
|
<p> <p>See also <a href="#inWhatsThisMode">inWhatsThisMode</a>(), <a href="#enterWhatsThisMode">enterWhatsThisMode</a>(), and <a href="#clicked">QWhatsThis::clicked</a>().
|
|
|
|
<h3 class=fn>void <a name="remove"></a>QWhatsThis::remove ( <a href="qwidget.html">QWidget</a> * widget )<tt> [static]</tt>
|
|
</h3>
|
|
Removes the "What's this?" help associated with the <em>widget</em>.
|
|
This happens automatically if the widget is destroyed.
|
|
<p> <p>See also <a href="#add">add</a>().
|
|
|
|
<h3 class=fn>void <a name="setFont"></a>QWhatsThis::setFont ( const <a href="qfont.html">QFont</a> & font )<tt> [static]</tt>
|
|
</h3>
|
|
Sets the font for all "What's this?" helps to <em>font</em>.
|
|
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QWhatsThis::text ( const <a href="qpoint.html">QPoint</a> & )<tt> [virtual]</tt>
|
|
</h3>
|
|
This virtual function returns the text for position <em>p</em> in the
|
|
widget that this "What's this?" object documents. If there is no
|
|
"What's this?" text for the position, <a href="qstring.html#QString-null">QString::null</a> is returned.
|
|
<p> The default implementation returns QString::null.
|
|
|
|
<h3 class=fn><a href="qstring.html">QString</a> <a name="textFor"></a>QWhatsThis::textFor ( <a href="qwidget.html">QWidget</a> * w, const <a href="qpoint.html">QPoint</a> & pos = QPoint ( ), bool includeParents = FALSE )<tt> [static]</tt>
|
|
</h3>
|
|
Returns the what's this text for widget <em>w</em> or <a href="qstring.html#QString-null">QString::null</a> if
|
|
there is no "What's this?" help for the widget. <em>pos</em> contains
|
|
the mouse position; this is useful, for example, if you've
|
|
subclassed to make the text that is displayed position dependent.
|
|
<p> If <em>includeParents</em> is TRUE, parent widgets are taken into
|
|
consideration as well when looking for what's this help text.
|
|
<p> <p>See also <a href="#add">add</a>().
|
|
|
|
<h3 class=fn><a href="qtoolbutton.html">QToolButton</a> * <a name="whatsThisButton"></a>QWhatsThis::whatsThisButton ( <a href="qwidget.html">QWidget</a> * parent )<tt> [static]</tt>
|
|
</h3>
|
|
Creates a <a href="qtoolbutton.html">QToolButton</a> preconfigured to enter "What's this?" mode
|
|
when clicked. You will often use this with a tool bar as <em>parent</em>:
|
|
<pre>
|
|
(void) QWhatsThis::whatsThisButton( my_help_tool_bar );
|
|
</pre>
|
|
|
|
|
|
<p>Example: <a href="helpsystem-example.html#x2699">helpsystem/mainwindow.cpp</a>.
|
|
<!-- 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>
|