Eneboo - Documentación para desarrolladores
Métodos públicos | Métodos públicos estáticos
Referencia de la Clase QWhatsThis

The QWhatsThis class provides a simple description of any widget, i.e. answering the question "What's this?". Más...

#include <qwhatsthis.h>

Diagrama de herencias de QWhatsThis
Qt Qt FLPopupWarn PropertyWhatsThis WhatPhrase

Lista de todos los miembros.

Métodos públicos

 QWhatsThis (QWidget *)
virtual ~QWhatsThis ()
virtual QString text (const QPoint &)
virtual bool clicked (const QString &href)
 QWhatsThis (QWidget *)
virtual ~QWhatsThis ()
virtual QString text (const QPoint &)
virtual bool clicked (const QString &href)

Métodos públicos estáticos

static void setFont (const QFont &font)
static void add (QWidget *, const QString &)
static void remove (QWidget *)
static QString textFor (QWidget *, const QPoint &pos=QPoint(), bool includeParents=FALSE)
static QToolButtonwhatsThisButton (QWidget *parent)
static void enterWhatsThisMode ()
static bool inWhatsThisMode ()
static void leaveWhatsThisMode (const QString &=QString::null, const QPoint &pos=QCursor::pos(), QWidget *w=0)
static void display (const QString &text, const QPoint &pos=QCursor::pos(), QWidget *w=0)
static void setFont (const QFont &font)
static void add (QWidget *, const QString &)
static void remove (QWidget *)
static QString textFor (QWidget *, const QPoint &pos=QPoint(), bool includeParents=FALSE)
static QToolButtonwhatsThisButton (QWidget *parent)
static void enterWhatsThisMode ()
static bool inWhatsThisMode ()
static void leaveWhatsThisMode (const QString &=QString::null, const QPoint &pos=QCursor::pos(), QWidget *w=0)
static void display (const QString &text, const QPoint &pos=QCursor::pos(), QWidget *w=0)

Descripción detallada

The 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.

action/application.cpp fileOpenText setWhatsThis

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.

whatsthis.png

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.

Ver también:
QToolTip

Documentación del constructor y destructor

QWhatsThis::QWhatsThis ( QWidget widget)

Constructs a dynamic "What's this?" object for widget. The object is deleted when the widget is destroyed.

When the widget is queried by the user the text() function of this QWhatsThis will be called to provide the appropriate text, rather than using the text assigned by add().

QWhatsThis::~QWhatsThis ( ) [virtual]

Destroys the object and frees any allocated resources.

QWhatsThis::QWhatsThis ( QWidget )
virtual QWhatsThis::~QWhatsThis ( ) [virtual]

Documentación de las funciones miembro

void QWhatsThis::add ( QWidget widget,
const QString text 
) [static]

Adds text as "What's this" help for widget. If the text is rich text formatted (i.e. it contains markup) it will be rendered with the default stylesheet QStyleSheet::defaultSheet().

The text is destroyed if the widget is later destroyed, so it need not be explicitly removed.

Ver también:
remove()
static void QWhatsThis::add ( QWidget ,
const QString  
) [static]
bool QWhatsThis::clicked ( const QString href) [virtual]

This virtual function is called when the user clicks inside the "What's this?" window. href is the link the user clicked on, or QString::null if there was no link.

If the function returns TRUE (the default), the "What's this?" window is closed, otherwise it remains visible.

The default implementation ignores href and returns TRUE.

Reimplementado en FLPopupWarn y PropertyWhatsThis.

virtual bool QWhatsThis::clicked ( const QString href) [virtual]

Reimplementado en FLPopupWarn y PropertyWhatsThis.

void QWhatsThis::display ( const QString text,
const QPoint pos = QCursor::pos(),
QWidget w = 0 
) [static]

Display text in a help window at the global screen position pos.

If widget w is not 0 and has its own dedicated QWhatsThis object, this object will receive clicked() messages when the user clicks on hyperlinks inside the help text.

Ver también:
QWhatsThis::clicked()
static void QWhatsThis::display ( const QString text,
const QPoint pos = QCursor::pos(),
QWidget w = 0 
) [static]
void QWhatsThis::enterWhatsThisMode ( ) [static]

Enters "What's this?" mode and returns immediately.

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.

The user can also use the Esc key to leave "What's this?" mode.

Ver también:
inWhatsThisMode(), leaveWhatsThisMode()
static void QWhatsThis::enterWhatsThisMode ( ) [static]
bool QWhatsThis::inWhatsThisMode ( ) [static]

Returns TRUE if the application is in "What's this?" mode; otherwise returns FALSE.

Ver también:
enterWhatsThisMode(), leaveWhatsThisMode()
static bool QWhatsThis::inWhatsThisMode ( ) [static]
static void QWhatsThis::leaveWhatsThisMode ( const QString = QString::null,
const QPoint pos = QCursor::pos(),
QWidget w = 0 
) [static]
void QWhatsThis::leaveWhatsThisMode ( const QString text = QString::null,
const QPoint pos = QCursor::pos(),
QWidget w = 0 
) [static]

Leaves "What's this?" question mode.

This function is used internally by widgets that support QWidget::customWhatsThis(); 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.

If text is not QString::null, a "What's this?" help window is displayed at the global screen position pos. If widget w is not 0 and has its own dedicated QWhatsThis object, this object will receive clicked() messages when the user clicks on hyperlinks inside the help text.

Ver también:
inWhatsThisMode(), enterWhatsThisMode(), QWhatsThis::clicked()
static void QWhatsThis::remove ( QWidget ) [static]
void QWhatsThis::remove ( QWidget widget) [static]

Removes the "What's this?" help associated with the widget. This happens automatically if the widget is destroyed.

Ver también:
add()
static void QWhatsThis::setFont ( const QFont font) [static]
void QWhatsThis::setFont ( const QFont font) [static]

Sets the font for all "What's this?" helps to font.

virtual QString QWhatsThis::text ( const QPoint ) [virtual]

Reimplementado en PropertyWhatsThis y WhatPhrase.

QString QWhatsThis::text ( const QPoint ) [virtual]

This virtual function returns the text for position p in the widget that this "What's this?" object documents. If there is no "What's this?" text for the position, QString::null is returned.

The default implementation returns QString::null.

Reimplementado en PropertyWhatsThis y WhatPhrase.

static QString QWhatsThis::textFor ( QWidget ,
const QPoint pos = QPoint(),
bool  includeParents = FALSE 
) [static]
QString QWhatsThis::textFor ( QWidget w,
const QPoint pos = QPoint(),
bool  includeParents = FALSE 
) [static]

Returns the what's this text for widget w or QString::null if there is no "What's this?" help for the widget. pos contains the mouse position; this is useful, for example, if you've subclassed to make the text that is displayed position dependent.

If includeParents is TRUE, parent widgets are taken into consideration as well when looking for what's this help text.

Ver también:
add()
static QToolButton* QWhatsThis::whatsThisButton ( QWidget parent) [static]
QToolButton * QWhatsThis::whatsThisButton ( QWidget parent) [static]

Creates a QToolButton preconfigured to enter "What's this?" mode when clicked. You will often use this with a tool bar as parent:

        (void) QWhatsThis::whatsThisButton( my_help_tool_bar );

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'