QWhatsThis Class ReferenceThe QWhatsThis class provides a simple description of any widget, i.e. answering the question "What's this?". More... #include <qwhatsthis.h> Inherits Qt. Public Members
Static Public Members
Detailed DescriptionThe QWhatsThis class provides a simple description of any widget, i.e. answering the question "What's this?".
"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. 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. (Note that if there is an accelerator for Shift+F1, this mechanism will not work.) To add "What's this?" text to a widget you simply call QWhatsThis::add() for the widget. For example, to assign text to a menu item, call QMenuData::setWhatsThis(); for a global accelerator key, call QAccel::setWhatsThis() and If you're using actions, use QAction::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 QStyleSheet::defaultSheet() for details.
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>"; QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", fileOpenAction->iconSet().pixmap() ); fileOpenAction->setWhatsThis( fileOpenText ); An alternative way to enter "What's this?" mode is to use the ready-made tool bar tool button from QWhatsThis::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.
If you are using QMainWindow you can also use the QMainWindow::whatsThis() slot to invoke the mode from a menu item. For more control you can create a dedicated QWhatsThis object for a special widget. By subclassing and reimplementing QWhatsThis::text() it is possible to have different help texts, depending on the position of the mouse click. By reimplementing QWhatsThis::clicked() it is possible to have hyperlinks inside the help texts. If you wish to control the "What's this?" behavior of a widget manually see QWidget::customWhatsThis(). The What's This object can be removed using QWhatsThis::remove(), although this is rarely necessary because it is automatically removed when the widget is destroyed.
See also QToolTip and Help System. Member Function Documentation
Constructs a dynamic "What's this?" object for widget. The
object is deleted when the widget is destroyed.
|
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 3.2 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com