Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 2041

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/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"><!--
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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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 &lt;<a href="qwhatsthis-h.html">qwhatsthis.h</a>&gt;</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><div class=fn><a href="#QWhatsThis"><b>QWhatsThis</b></a> ( QWidget&nbsp;*&nbsp;widget )</div></li>
<li><div class=fn>virtual <a href="#~QWhatsThis"><b>~QWhatsThis</b></a> ()</div></li>
<li><div class=fn>virtual QString <a href="#text"><b>text</b></a> ( const QPoint &amp; )</div></li>
<li><div class=fn>virtual bool <a href="#clicked"><b>clicked</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;href )</div></li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class=fn>void <a href="#add"><b>add</b></a> ( QWidget&nbsp;*&nbsp;widget, const&nbsp;QString&nbsp;&amp;&nbsp;text )</div></li>
<li><div class=fn>void <a href="#remove"><b>remove</b></a> ( QWidget&nbsp;*&nbsp;widget )</div></li>
<li><div class=fn>QString <a href="#textFor"><b>textFor</b></a> ( QWidget&nbsp;*&nbsp;w, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos = QPoint ( ), bool&nbsp;includeParents = FALSE )</div></li>
<li><div class=fn>QToolButton * <a href="#whatsThisButton"><b>whatsThisButton</b></a> ( QWidget&nbsp;*&nbsp;parent )</div></li>
<li><div class=fn>void <a href="#enterWhatsThisMode"><b>enterWhatsThisMode</b></a> ()</div></li>
<li><div class=fn>bool <a href="#inWhatsThisMode"><b>inWhatsThisMode</b></a> ()</div></li>
<li><div class=fn>void <a href="#leaveWhatsThisMode"><b>leaveWhatsThisMode</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text = QString::null, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos = QCursor::pos ( ), QWidget&nbsp;*&nbsp;w = 0 )</div></li>
<li><div class=fn>void <a href="#display"><b>display</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos = QCursor::pos ( ), QWidget&nbsp;*&nbsp;w = 0 )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


<p> 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 <a href="helpsystem.html#online-help">online help</a> system
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
which 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 = "&lt;p&gt;&lt;img source=\"fileopen\"&gt; "
                         "Click this button to open a &lt;em&gt;new file&lt;/em&gt;. &lt;br&gt;"
                         "You can also select the &lt;b&gt;Open&lt;/b&gt; command "
                         "from the &lt;b&gt;File&lt;/b&gt; menu.&lt;/p&gt;";
    <a name="x4"></a>    QMimeSourceFactory::<a href="qmimesourcefactory.html#defaultFactory">defaultFactory</a>()-&gt;setPixmap( "fileopen",
    <a name="x2"></a>                          fileOpenAction-&gt;<a href="qaction.html#iconSet">iconSet</a>().pixmap() );
    <a name="x3"></a>    fileOpenAction-&gt;<a href="qaction.html#setWhatsThis">setWhatsThis</a>( fileOpenText );
</pre>
<p> (For further explanation of the above code refer to the
<a href="simple-application-action.html">Simple Application Walkthrough
  featuring QAction</a>.)
<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> <img src="whatsthis.png" width="284" height="246">
<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>&nbsp;*&nbsp;widget )
</h3>
Constructs a dynamic "What's this?" object for <em>widget</em>. The object
is deleted when the passed widget 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>&nbsp;*&nbsp;widget, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;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#x1946">application/application.cpp</a> and <a href="mdi-example.html#x1179">mdi/application.cpp</a>.
<h3 class=fn>bool <a name="clicked"></a>QWhatsThis::clicked ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;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.
<p> 
<h3 class=fn>void <a name="display"></a>QWhatsThis::display ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos = QCursor::pos ( ), <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;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 null 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>().

<p> 
<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 switches
out of "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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text = QString::null, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos = QCursor::pos ( ), <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;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 null string, a "What's this?" help window is
displayed at the global screen position <em>pos</em>.  If widget <em>w</em> is
not null 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>&nbsp;*&nbsp;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>See also <a href="#add">add</a>().

<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QWhatsThis::text ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; )<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 a 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>&nbsp;*&nbsp;w, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos = QPoint ( ), bool&nbsp;includeParents = FALSE )<tt> [static]</tt>
</h3>
Returns the what's this text for widget <em>w</em> or a null string 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.
<p> <p>See also <a href="#add">add</a>().

<h3 class=fn><a href="qtoolbutton.html">QToolButton</a>&nbsp;* <a name="whatsThisButton"></a>QWhatsThis::whatsThisButton ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;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>
 

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 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 &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>