• 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)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Static Public Member Functions

static ToolTipManager * self ()
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

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-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:13 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • 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