⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qtooltip.3qt

📁 Trolltech公司发布的基于C++图形开发环境
💻 3QT
字号:
'\" t.TH QToolTip 3qt "24 January 2005" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQToolTip \- Tool tips (sometimes called balloon help) for any widget or rectangular part of a widget.br.PP\fC#include <qtooltip.h>\fR.PPInherits Qt..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQToolTip\fR ( QWidget *, QToolTipGroup * = 0 ) ".br.ti -1c.BI "QWidget* \fBparentWidget\fR () const".br.ti -1c.BI "QToolTipGroup* \fBgroup\fR () const".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "void \fBadd\fR ( QWidget *, const QString & ) ".br.ti -1c.BI "void \fBadd\fR ( QWidget *, const QString &, QToolTipGroup *, const QString & ) ".br.ti -1c.BI "void \fBremove\fR ( QWidget * ) ".br.ti -1c.BI "void \fBadd\fR ( QWidget *, const QRect &, const QString & ) ".br.ti -1c.BI "void \fBadd\fR ( QWidget *, const QRect &, const QString &, QToolTipGroup *, const QString & ) ".br.ti -1c.BI "void \fBremove\fR ( QWidget *, const QRect & ) ".br.ti -1c.BI "void \fBhide\fR () ".br.ti -1c.BI "QFont \fBfont\fR () ".br.ti -1c.BI "void \fBsetFont\fR ( const QFont & ) ".br.ti -1c.BI "QPalette \fBpalette\fR () ".br.ti -1c.BI "void \fBsetPalette\fR ( const QPalette & ) ".br.ti -1c.BI "void \fBsetEnabled\fR ( bool ) ".br.ti -1c.BI "bool \fBenabled\fR () ".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBmaybeTip\fR ( const QPoint & ) ".br.ti -1c.BI "void \fBtip\fR ( const QRect &, const QString & ) ".br.ti -1c.BI "void \fBtip\fR ( const QRect &, const QString &, const QString & ) ".br.ti -1c.BI "void \fBclear\fR () ".br.in -1c.SH DESCRIPTIONThe QToolTip class provides tool tips (sometimes called balloon help) for any widget or rectangular part of a widget..PPThe tip is a short, one-line text reminding the user of the widget's or rectangle's function. It is drawn immediately below the region, in a distinctive black on yellow combination. In Motif style, Qt's tool tips look much like Motif's but feel more like Windows 95 tool tips..PPQToolTipGroup provides a way for tool tips to display another text elsewhere (most often in a status bar)..PPAt any point in time, QToolTip is either dormant or active. In dormant mode the tips are not shown, and in active mode they are. The mode is global, not particular to any one widget..PPQToolTip switches from dormant to active mode when the user lets the mouse rest on a tip-equipped region for a second or so, and remains in active mode until the user either clicks a mouse button, presses a key, lets the mouse rest for five seconds, or moves the mouse outside \fIall\fR tip-equpped regions for at least a second..PPThe QToolTip class can be used in three different ways: .IP 1Adding a tip to an entire widget. .IP 2Adding a tip to a fixed rectangle within a widget. .IP 3Adding a tip to a dynamic rectangle within a widget. .PPTo add a tip to a widget, call the \fIstatic\fR function QToolTip::add() with the widget and tip as arguments:.PP.nf.br    QToolTip::add( quitButton, "Leave the application" );.fi.PPThis is the simplest and most common use of QToolTip. The tip will be deleted automatically when \fIquitButton\fR is deleted, but you can remove it yourself, too:.PP.nf.br    QToolTip::remove( quitButton );.fi.PPYou can also display another text (typically in a status bar), courtesy of QToolTipGroup. This example assumes that \fIg\fR is a \fCQToolTipGroup *\fR and already connected to the appropriate status bar:.PP.nf.br    QToolTip::add( quitButton, "Leave the application", g,.br                   "Leave the application, without asking for confirmation" );.br    QToolTip::add( closeButton, "Close this window", g,.br                   "Close this window, without asking for confirmation" );.fi.PPTo add a tip to a fixed rectangle within a widget, call the static function QToolTip::add() with the widget, rectangle and tip as arguments. (See the tooltip/tooltip.cpp example.) Again, you can supply a QToolTipGroup * and another text if you want..PPBoth of the above are one-liners and cover the vast majority of cases. The third and most general way to use QToolTip uses a pure virtual function to decide whether to pop up a tool tip. The tooltip/tooltip.cpp example demonstrates this too. This mode can be used to implement e.g. tips for text that can move as the user scrolls..PPTo use QToolTip like this, you need to subclass QToolTip and reimplement maybeTip(). maybeTip() will be called when there's a chance that a tip should pop up. It must decide whether to show a tip, and possibly call add() with the rectangle the tip applies to, the tip's text and optionally the QToolTipGroup details. The tip will disappear once the mouse moves outside the rectangle you supply, and \fInot reappear\fR - maybeTip() will be called again if the user lets the mouse rest within the same rectangle again. You can forcibly remove the tip by calling remove() with no arguments. This is handy if the widget scrolls..PPTooltips can be globally disabled using QToolTip::setEnabled(), or disabled in groups with QToolTipGroup::setEnabled()..PPSee also QStatusBar, QWhatsThis, QToolTipGroup and GUI Design Handbook: Tool Tip.SH MEMBER FUNCTION DOCUMENTATION.SH "QToolTip::QToolTip ( QWidget * parent, QToolTipGroup * group = 0 )"Constructs a tool tip object. This is necessary only if you need tool tips on regions that can move within the widget (most often because the widget's contents can scroll)..PP\fIparent\fR is the widget you want to add dynamic tool tips to and \fIgroup\fR (optional) is the tool tip group they should belong to..PPSee also maybeTip()..SH "void QToolTip::add ( QWidget * widget, const QRect & rect, const QString & text ) \fC[static]\fR"Adds a tool tip to a fixed rectangle within \fIwidget. text\fR is the text shown in the tool tip. QToolTip makes a deep copy of this string..SH "void QToolTip::add ( QWidget * widget, const QRect & rect, const QString & text, QToolTipGroup * group, const QString & groupText ) \fC[static]\fR"Adds a tool tip to an entire \fIwidget,\fR and to tool tip group \fIgroup.\fR.PP\fItext\fR is the text shown in the tool tip and \fIlongText\fR is the text emitted from \fIgroup.\fR QToolTip makes deep copies of both strings..PPNormally, \fIlongText\fR is shown in a status bar or similar..SH "void QToolTip::add ( QWidget * widget, const QString & text ) \fC[static]\fR"Adds a tool tip to \fIwidget. text\fR is the text to be shown in the tool tip. QToolTip makes a deep copy of this string..PPThis is the most common entry point to the QToolTip class; it is suitable for adding tool tips to buttons, check boxes, combo boxes and so on..SH "void QToolTip::add ( QWidget * widget, const QString & text, QToolTipGroup * group, const QString & longText ) \fC[static]\fR"Adds a tool tip to \fIwidget,\fR and to tool tip group \fIgroup.\fR.PP\fItext\fR is the text shown in the tool tip and \fIlongText\fR is the text emitted from \fIgroup.\fR QToolTip makes deep copies of both strings..PPNormally, \fIlongText\fR is shown in a status bar or similar..SH "void QToolTip::clear () \fC[protected]\fR"Removes all tool tips for this tooltip's parent widget immediately..SH "bool QToolTip::enabled () \fC[static]\fR"Returns whether tooltips are enabled globally..PPSee also setEnabled()..SH "QFont QToolTip::font () \fC[static]\fR"Returns the font common to all tool tips..PPSee also setFont()..SH "QToolTipGroup * QToolTip::group () const"Returns the tool tip group this QToolTip is a member of, of 0 if it isn't a member of any group..PPThe tool tip group is the object responsible for relaying contact between tool tips and a status bar or something else which can show a longer help text..PPSee also parentWidget() and QToolTipGroup..SH "void QToolTip::hide () \fC[static]\fR"Hides any tip that is currently being shown..PPNormally, there is no need to call this function; QToolTip takes care of showing and hiding the tips as the user moves the mouse..SH "virtual void QToolTip::maybeTip ( const QPoint & p ) \fC[virtual protected]\fR"This pure virtual function is half of the most versatile interface QToolTip offers..PPIt is called when there is a chance that a tool tip should be shown, and must decide whether there is a tool tip for the point \fIp\fR in the widget this QToolTip object relates to..PP\fIp\fR is given in that widget's local coordinates. Most maybeTip() implementation will be of the form:.PP.nf.br    if ( <something> ) {.br        tip( <something>, <something> );.br    }.fi.PPThe first argument to tip() (a rectangle) should include the \fIp,\fR or QToolTip, the user or both can be confused..PPSee also tip()..SH "QPalette QToolTip::palette () \fC[static]\fR"Returns the palette common to all tool tips..PPSee also setPalette()..SH "QWidget * QToolTip::parentWidget () const"Returns the widget this QToolTip applies to..PPThe tool tip is destroyed automatically when the parent widget is destroyed..PPSee also group()..SH "void QToolTip::remove ( QWidget * widget ) \fC[static]\fR"Remove the tool tip from \fIwidget.\fR.PPIf there are more than one tool tip on \fIwidget,\fR only the one covering the entire widget is removed..SH "void QToolTip::remove ( QWidget * widget, const QRect & rect ) \fC[static]\fR"Remove the tool tip for \fIrect\fR from \fIwidget.\fR.PPIf there are more than one tool tip on \fIwidget,\fR only the one covering rectangle \fIrect\fR is removed..SH "void QToolTip::setEnabled ( bool enable ) \fC[static]\fR"Sets the all tool tips to be enabled (shown when needed) or disabled (never shown)..PPBy default, tool tips are enabled. Note that this function effects all tooltips in the entire application..PPSee also QToolTipGroup::setEnabled()..SH "void QToolTip::setFont ( const QFont & font ) \fC[static]\fR"Sets the font for all tool tips to \fIfont.\fR.PPSee also font()..SH "void QToolTip::setPalette ( const QPalette & palette ) \fC[static]\fR"Sets the palette for all tool tips to \fIpalette.\fR.PPSee also palette()..SH "void QToolTip::tip ( const QRect & rect, const QString & text ) \fC[protected]\fR"Pops up a tip saying \fItext\fR right now, and removes that tip once the cursor moves out of rectangle \fIrect\fR (which is given in the coordinate system of the widget this QToolTip relates to)..PPThe tip will not come back if the cursor moves back; your maybeTip() has to reinstate it each time..SH "void QToolTip::tip ( const QRect & rect, const QString & text, const QString & groupText ) \fC[protected]\fR"Pops up a tip saying \fItext\fR right now, and removes that tip once the cursor moves out of rectangle \fIrect.\fR.PPThe tip will not come back if the cursor moves back; your maybeTip()has to reinstate it each time..SH "SEE ALSO".BR http://doc.trolltech.com/qtooltip.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qtooltip.3qt) and the Qtversion (2.3.10).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -