Plasma
#include <Plasma/ToolTipManager>
Public Types | |
enum | State { Activated = 0, Inhibited, Deactivated } |
Signals | |
void | linkActivated (const QString &anchor, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint &screenPos) |
void | windowPreviewActivated (WId window, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint &screenPos) |
Public Member Functions | |
void | clearContent (QGraphicsWidget *widget) |
void | hide (QGraphicsWidget *widget) |
bool | isVisible (QGraphicsWidget *widget) const |
void | registerWidget (QGraphicsWidget *widget) |
void | setContent (QGraphicsWidget *widget, const ToolTipContent &data) |
void | setState (ToolTipManager::State state) |
void | show (QGraphicsWidget *widget) |
ToolTipManager::State | state () const |
void | unregisterWidget (QGraphicsWidget *widget) |
Static Public Member Functions | |
static ToolTipManager * | self () |
Detailed Description
Manages tooltips for QGraphicsWidgets in Plasma.
If you want a widget to have a tooltip displayed when the mouse is hovered over it, you should do something like:
Note that, since a Plasma::Applet is a QGraphicsWidget, you can use Plasma::ToolTipManager::self()->setContent(this, data); in the applet's init() method to set a tooltip for the whole applet.
The tooltip will be registered automatically by setContent(). It will be automatically unregistered when the associated widget is deleted, freeing the memory used by the tooltip, but you can manually unregister it at any time by calling unregisterWidget().
When a tooltip for a widget is about to be shown, the widget's toolTipAboutToShow() slot will be invoked if it exists. Similarly, when a tooltip is hidden, the widget's toolTipHidden() slot will be invoked if it exists. This allows widgets to provide on-demand tooltip data.
Definition at line 69 of file tooltipmanager.h.
Member Enumeration Documentation
Enumerator | |
---|---|
Activated |
< Will accept tooltip data and show tooltips |
Inhibited |
< Will accept tooltip data, but not show tooltips |
Deactivated |
< Will discard tooltip data, and not attempt to show them |
Definition at line 74 of file tooltipmanager.h.
Member Function Documentation
void Plasma::ToolTipManager::clearContent | ( | QGraphicsWidget * | widget | ) |
Clears the tooltip data associated with this widget, but keeps the widget registered.
Definition at line 272 of file tooltipmanager.cpp.
void Plasma::ToolTipManager::hide | ( | QGraphicsWidget * | widget | ) |
Hides the tooltip for a widget immediately.
- Parameters
-
widget the widget to hide the tooltip for
Definition at line 188 of file tooltipmanager.cpp.
bool Plasma::ToolTipManager::isVisible | ( | QGraphicsWidget * | widget | ) | const |
Find out whether the tooltip for a given widget is currently being displayed.
- Parameters
-
widget the widget to check the tooltip for
- Returns
- true if the tooltip of the widget is currently displayed, false if not
Definition at line 170 of file tooltipmanager.cpp.
|
signal |
This signal is emitted when a link in the tooltip is clicked.
- Parameters
-
anchor the achor text (e.g. url) that was clicked on buttons the mouse buttons involved in the activation modifiers the keyboard modifiers involved in the activation, if any
- Since
- 4.4
void Plasma::ToolTipManager::registerWidget | ( | QGraphicsWidget * | widget | ) |
Registers a widget with the tooltip manager.
Note that setContent() will register the widget if it has not already been registered, and so you do not normally need to use the method.
This is useful for creating tooltip content on demand. You can register your widget with registerWidget(), then implement a slot named toolTipAboutToShow for the widget. This will be called before the tooltip is shown, allowing you to set the data with setContent().
If the widget also has a toolTipHidden slot, this will be called after the tooltip is hidden.
- Parameters
-
widget the desired widget
Definition at line 200 of file tooltipmanager.cpp.
|
static |
- Returns
- The singleton instance of the manager.
Definition at line 119 of file tooltipmanager.cpp.
void Plasma::ToolTipManager::setContent | ( | QGraphicsWidget * | widget, |
const ToolTipContent & | data | ||
) |
Sets the content for the tooltip associated with a widget.
Note that this will register the widget with the ToolTipManager if necessary, so there is usually no need to call registerWidget().
- Parameters
-
widget the widget the tooltip should be associated with data the content of the tooltip. If an empty Content is passed in, the tooltip content will be reset.
Definition at line 229 of file tooltipmanager.cpp.
void Plasma::ToolTipManager::setState | ( | ToolTipManager::State | state | ) |
Sets the current state of the manager.
- See also
- State
- Parameters
-
state the state to put the manager in
Definition at line 277 of file tooltipmanager.cpp.
void Plasma::ToolTipManager::show | ( | QGraphicsWidget * | widget | ) |
Show the tooltip for a widget registered in the tooltip manager.
- Parameters
-
widget the widget for which the tooltip will be displayed
Definition at line 141 of file tooltipmanager.cpp.
ToolTipManager::State Plasma::ToolTipManager::state | ( | ) | const |
- Returns
- the current state of the manager;
- See also
- State
Definition at line 293 of file tooltipmanager.cpp.
void Plasma::ToolTipManager::unregisterWidget | ( | QGraphicsWidget * | widget | ) |
Unregisters a widget from the tooltip manager.
This will free the memory used by the tooltip associated with the widget.
- Parameters
-
widget the desired widget to delete
Definition at line 212 of file tooltipmanager.cpp.
|
signal |
This signal is emitted when a window preview in the tooltip is clicked.
- Parameters
-
window the id of the window that was clicked buttons the mouse buttons involved in the activation modifiers the keyboard modifiers involved in the activation, if any
- Since
- 4.4
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:35 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.