Skip to content

PythonQt.Qt.QToolTip

QToolTip

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

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 displayed in a tool tip is implicitly word-wrapped unless specified differently with <p style='white-space:pre'>.

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

It is also possible to show different tool tips 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.

If you are calling QToolTip::hideText(), or QToolTip::showText() with an empty string, as a result of a ToolTip-event you should also call ignore() on the event, to signal that you don't want to start any tooltip specific modes.

Note that, if you want to show tooltips in an item view, the model/view architecture provides functionality to set an item's tool tip; e.g., the QTableWidgetItem::setToolTip() function. However, if you want to provide custom tool tips in an item view, you must intercept the help event in the QAbstractItemView::viewportEvent() function and handle it yourself.

The default tool tip color and font can be customized with setPalette() and setFont(). When a tooltip is currently on display, isVisible() returns true and text() the currently visible text.

Note: Tool tips use the inactive color group of QPalette, because tool tips are not active windows.

Source: https://doc.qt.io/archives/qt-5.15/qtooltip.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
font function (self) -> Any X.font() -> PythonQt.QtGui.QFont (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
hideText function (self) -> None Hides the tool tip. (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
isVisible function (self) -> bool X.isVisible() -> bool (shared captured text)
palette function (self) -> Any X.palette() -> PythonQt.QtGui.QPalette (shared captured text)
setFont function (self, arg__1: Any) -> None Sets the font used to render tooltips. (shared captured text)
setPalette function (self, arg__1: Any) -> None Sets the palette used to render tooltips. (shared captured text)
showText function (self, pos: Any, text: str, w: Any, rect: Any, msecShowTime: Any) -> None X.showText(pos, text, w, rect, msecShowTime) (shared captured text)
text function (self) -> str X.text() -> str (shared captured text)