On this page |
This class inherits from Qt’s QtWidgets.QWidget
class.
Methods ¶
__init__()
Create and return a new tooltip window.
setTitle(title)
Set the tooltip’s title. The title appears at the top of the window. If no title is set then the tooltip window does not display the title area.
setText(text)
Set the tooltip’s main text.
setHotkey(hotkey)
Sets a hotkey to display in the tooltip.
hotkey
must be a key sequence such as “G”, “Shift+G” or “Cmd+G”.
setHelpUrl(help_url)
Link the tooltip to the given help web page. When a help URL is set then the user can press F1 while the tooltip is visible to open the help web page.
help_url
can be either a fully qualified URL or a Houdini help path.
For example, passing in “/nodes/sop/torus” as the help URL will cause the
tooltip window to open the SOP Torus help page when F1 is pressed.
setTargetWidget(widget)
Sets the widget that the tooltip is attached to. When the cursor is hovered over the target widget then the tooltip window is opened. And when the cursor is moved outside of the target widget’s area then the tooltip window is closed.
Setting the target widget will cause the tooltip to detach itself from any previous target widget.
Examples ¶
This example demonstrates creating a tooltip window and attaching it to a button:
tooltip = hou.qt.ToolTip() tooltip.setTitle("Tooltip Example - SOP Torus Help") tooltip.setText("This tooltip links to the SOP Torus help page.") tooltip.setHotkey("Shift+H") tooltip.setHelpUrl("/nodes/sop/torus") btn = QtWidgets.QPushButton("Hover Me") tooltip.setTargetWidget(btn)