com.trolltech.qt.gui
Class QToolTip

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.gui.QToolTip
All Implemented Interfaces:
QtJambiInterface

public final class QToolTip
extends QtJambiObject

The QToolTip class provides tooltips (balloon help) for any widget.

The tip is a short piece of text reminding the user of the widget's function. It is drawn immediately below the given position in a distinctive black-on-yellow color combination. The tip can be any rich text formatted string.

Rich text formatted tips implictely do word breaking, unless specified differently with <p style='white-space:pre'>.

The simplest and most common way to set a widget's tooltip is by calling its QWidget::setToolTip() function.

It is also possible to show different tooltips for different regions of a widget, by using a QHelpEvent of type QEvent::ToolTip. Intercept the help event in your widget's event() function and call QToolTip::showText() with the text you want to display. The Tooltips example illustrates this technique.

Note that if you want to show tooltips in an item view, the model/view architecture provides functionality to set an item's tootip, e.g., the QTableWidgetItem::setToolTip() function. But if you want to provide custom tooltips in an item view you must intercept the help event in the QAbstractItemView::viewportEvent() function instead.

The default tooltip color and font can be customized with setPalette and setFont.

See Also:
QWidget::toolTip, QAction::toolTip, Example

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Method Summary
static QFont font()
          Returns the font used to render tooltips.
static QToolTip fromNativePointer(QNativePointer nativePointer)
          This function returns the QToolTip instance pointed to by nativePointer
static void hideText()
          Hides the tool tip.
static QPalette palette()
          Returns the palette used to render tooltips.
static void setFont(QFont arg__1)
          Sets the arg__1 used to render tooltips.
static void setPalette(QPalette arg__1)
          Sets the arg__1 used to render tooltips.
static void showText(QPoint pos, java.lang.String text)
          Equivalent to showText(pos, text, 0).
static void showText(QPoint pos, java.lang.String text, QWidget w)
          This is analogous to calling QToolTip::showText(pos, text, w, QRect())
static void showText(QPoint pos, java.lang.String text, QWidget w, QRect rect)
          Shows text as a tool tip, at global position pos.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Method Detail

font

public static QFont font()

Returns the font used to render tooltips.

See Also:
setFont

hideText

public static void hideText()

Hides the tool tip. This is the same as calling showText with an empty string.

See Also:
showText

palette

public static QPalette palette()

Returns the palette used to render tooltips.

See Also:
setPalette

setFont

public static void setFont(QFont arg__1)

Sets the arg__1 used to render tooltips.

See Also:
font

setPalette

public static void setPalette(QPalette arg__1)

Sets the arg__1 used to render tooltips.

See Also:
palette

showText

public static void showText(QPoint pos,
                            java.lang.String text,
                            QWidget w,
                            QRect rect)

Shows text as a tool tip, at global position pos. If you specify a non-empty rect the tip will be hidden as soon as you move your cursor out of this area.

The rect is in the coordinates of the widget you specify with w. If the rect is not empty you must specify a widget. Otherwise this argument can be 0 but it is used to determine the appropriate screen on multi-head systems.

If text is empty the tool tip is hidden. If the text is the same as the currently shown tooltip, the tip will not move. You can force moving by first hiding the tip with an empty text, and then showing the new tip at the new position.


showText

public static void showText(QPoint pos,
                            java.lang.String text)

Equivalent to showText(pos, text, 0).


showText

public static void showText(QPoint pos,
                            java.lang.String text,
                            QWidget w)

This is analogous to calling QToolTip::showText(pos, text, w, QRect())


fromNativePointer

public static QToolTip fromNativePointer(QNativePointer nativePointer)
This function returns the QToolTip instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.