What's this?" help is part of an application's online help 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.
TQWhatsThis 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.
To add "What's this?" text to a widget you simply call TQWhatsThis::add() for the widget. For example, to assign text to a menu item, call TQMenuData::setWhatsThis(); for a global accelerator key, call TQAccel::setWhatsThis() and If you're using actions, use TQAction::setWhatsThis().
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 TQStyleSheet::defaultSheet() for details.
An alternative way to enter "What's this?" mode is to use the ready-made tool bar tool button from TQWhatsThis::whatsThisButton(). 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.
For more control you can create a dedicated TQWhatsThis object for a special widget. By subclassing and reimplementing TQWhatsThis::text() it is possible to have different help texts, depending on the position of the mouse click. By reimplementing TQWhatsThis::clicked() it is possible to have hyperlinks inside the help texts.
The What's This object can be removed using TQWhatsThis::remove(), although this is rarely necessary because it is automatically removed when the widget is destroyed.
When the widget is queried by the user the text() function of this TQWhatsThis will be called to provide the appropriate text, rather than using the text assigned by add().
Adds \fItext\fR as "What's this" help for \fIwidget\fR. If the text is rich text formatted (i.e. it contains markup) it will be rendered with the default stylesheet TQStyleSheet::defaultSheet().
This virtual function is called when the user clicks inside the" What's this?" window. \fIhref\fR is the link the user clicked on, or TQString::null if there was no link.
If widget \fIw\fR is not 0 and has its own dedicated TQWhatsThis object, this object will receive clicked() messages when the user clicks on hyperlinks inside the help text.
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, TQt removes the special cursor and help window and then restores ordinary event processing, at which point the left mouse button is no longer pressed.
This function is used internally by widgets that support TQWidget::customWhatsThis(); applications do not usually call it. An example of such a widget is TQPopupMenu: menus still work normally in "What's this?" mode but also provide help texts for individual menu items.
If \fItext\fR is not TQString::null, a "What's this?" help window is displayed at the global screen position \fIpos\fR. If widget \fIw\fR is not 0 and has its own dedicated TQWhatsThis object, this object will receive clicked() messages when the user clicks on hyperlinks inside the help text.
This virtual function returns the text for position \fIp\fR in the widget that this "What's this?" object documents. If there is no" What's this?" text for the position, TQString::null is returned.
Returns the what's this text for widget \fIw\fR or TQString::null if there is no "What's this?" help for the widget. \fIpos\fR contains the mouse position; this is useful, for example, if you've subclassed to make the text that is displayed position dependent.