• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • Plasma
  • ToolTipManager
Public Types | Signals | Public Member Functions | Static Public Member Functions | List of all members
Plasma::ToolTipManager Class Reference

#include <Plasma/ToolTipManager>

Inheritance diagram for Plasma::ToolTipManager:
Inheritance graph
[legend]

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:

// widget is a QGraphicsWidget*
Plasma::ToolTipContent data;
data.mainText = i18n("My Title");
data.subText = i18n("This is a little tooltip");
data.image = KIcon("some-icon").pixmap(IconSize(KIconLoader::Desktop));
Plasma::ToolTipManager::self()->setContent(widget, data);

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

enum Plasma::ToolTipManager::State
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
widgetthe 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
widgetthe 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.

void Plasma::ToolTipManager::linkActivated ( const QString &  anchor,
Qt::MouseButtons  buttons,
Qt::KeyboardModifiers  modifiers,
const QPoint &  screenPos 
)
signal

This signal is emitted when a link in the tooltip is clicked.

Parameters
anchorthe achor text (e.g. url) that was clicked on
buttonsthe mouse buttons involved in the activation
modifiersthe 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
widgetthe desired widget

Definition at line 200 of file tooltipmanager.cpp.

ToolTipManager * Plasma::ToolTipManager::self ( )
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
widgetthe widget the tooltip should be associated with
datathe 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
statethe 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
widgetthe 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
widgetthe desired widget to delete

Definition at line 212 of file tooltipmanager.cpp.

void Plasma::ToolTipManager::windowPreviewActivated ( WId  window,
Qt::MouseButtons  buttons,
Qt::KeyboardModifiers  modifiers,
const QPoint &  screenPos 
)
signal

This signal is emitted when a window preview in the tooltip is clicked.

Parameters
windowthe id of the window that was clicked
buttonsthe mouse buttons involved in the activation
modifiersthe keyboard modifiers involved in the activation, if any
Since
4.4

The documentation for this class was generated from the following files:
  • tooltipmanager.h
  • tooltipmanager.cpp
This file is part of the KDE documentation.
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.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal