Q3WhatsThis Class

头: #include <Q3WhatsThis>
继承: QObject

公共函数

Q3WhatsThis (QWidget * widget )
~Q3WhatsThis ()
virtual bool clicked (const QString & href )
virtual QString text (const QPoint & pos )

静态公共成员

void add (QWidget * widget , const QString & text )
void display (const QString & text , const QPoint & pos = QCursor::pos(), QWidget * widget = 0)
void enterWhatsThisMode ()
bool inWhatsThisMode ()
void leaveWhatsThisMode (const QString & text = QString(), const QPoint & pos = QCursor::pos(), QWidget * widget = 0)
void remove (QWidget * widget )
QToolButton * whatsThisButton (QWidget * parent )

额外继承成员

详细描述

成员函数文档编制

Q3WhatsThis:: Q3WhatsThis ( QWidget * widget )

Constructs a new "What's This?" object for widget .

Q3WhatsThis:: ~Q3WhatsThis ()

Destroys the "What's This?" object.

[static] void Q3WhatsThis:: add ( QWidget * widget , const QString & text )

添加 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.

另请参阅 remove ().

[虚拟] bool Q3WhatsThis:: clicked (const QString & href )

This virtual function is called when the user clicks inside the "What's this?" window. href is the link the user clicked on, or an empty string 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.

[static] void Q3WhatsThis:: display (const QString & text , const QPoint & pos = QCursor::pos(), QWidget * widget = 0)

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

If widget widget 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.

另请参阅 clicked ().

[static] void Q3WhatsThis:: enterWhatsThisMode ()

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.

另请参阅 inWhatsThisMode () 和 leaveWhatsThisMode ().

[static] bool Q3WhatsThis:: inWhatsThisMode ()

Returns true if the application is in "What's This?" mode; otherwise returns false.

另请参阅 enterWhatsThisMode () 和 leaveWhatsThisMode ().

[static] void Q3WhatsThis:: leaveWhatsThisMode (const QString & text = QString(), const QPoint & pos = QCursor::pos(), QWidget * widget = 0)

This function is used internally by widgets that support QWidget::customWhatsThis(); applications do not usually call it. An example of such a widget is Q3PopupMenu : menus still work normally in "What's This?" mode but also provide help texts for individual menu items.

text is not empty, a "What's This?" help window is displayed at the global screen position pos . If widget widget 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.

另请参阅 inWhatsThisMode (), enterWhatsThisMode (),和 clicked ().

[static] void Q3WhatsThis:: remove ( QWidget * widget )

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

另请参阅 add ().

[虚拟] QString Q3WhatsThis:: text (const QPoint & pos )

This virtual function returns the text for position pos in the widget that this "What's This?" object documents. If there is no "What's This?" text for the position, an empty string is returned.

The default implementation returns an empty string.

[static] QToolButton * Q3WhatsThis:: whatsThisButton ( QWidget * parent )

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

(void)Q3WhatsThis::whatsThisButton( my_help_tool_bar );