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

Plasma

Plasma::Applet

Plasma::Applet Class Reference

The base Applet class. More...

#include <Plasma/Applet>

Inheritance diagram for Plasma::Applet:

Inheritance graph
[legend]

List of all members.


Public Types

enum  { Type = Plasma::AppletType }
enum  BackgroundHint { NoBackground = 0, StandardBackground = 1, TranslucentBackground = 2, DefaultBackground = StandardBackground }
typedef QHash< QString, Applet * > Dict
typedef QList< Applet * > List

Public Slots

virtual void configChanged ()
virtual void destroy ()
void flushPendingConstraintsEvents ()
virtual void init ()
void lower ()
void raise ()
void setBusy (bool busy)
void setImmutability (const ImmutabilityType immutable)
virtual void showConfigurationInterface ()

Signals

void activate ()
void configNeedsSaving ()
void geometryChanged ()
void releaseVisualFocus ()
void sizeHintChanged (Qt::SizeHint which)

Public Member Functions

QAction * action (QString name) const
void addAction (QString name, QAction *action)
virtual void addAssociatedWidget (QWidget *widget)
 Applet (QGraphicsItem *parent=0, const QString &serviceId=QString(), uint appletId=0)
Plasma::AspectRatioMode aspectRatioMode () const
BackgroundHints backgroundHints () const
QString category () const
KConfigGroup config (const QString &group) const
KConfigGroup config () const
ConfigLoader * configScheme () const
bool configurationRequired () const
Containment * containment () const
Context * context () const
virtual QList< QAction * > contextualActions ()
Q_INVOKABLE DataEngine * dataEngine (const QString &name) const
bool destroyed () const
QFont font () const
virtual FormFactor formFactor () const
KConfigGroup globalConfig () const
KShortcut globalShortcut () const
bool hasConfigurationInterface () const
bool hasFailedToLaunch () const
QString icon () const
uint id () const
ImmutabilityType immutability () const
virtual void initExtenderItem (ExtenderItem *item)
bool isBusy () const
bool isContainment () const
virtual bool isPopupShowing () const
virtual Location location () const
QRectF mapFromView (const QGraphicsView *view, const QRect &rect) const
QRect mapToView (const QGraphicsView *view, const QRectF &rect) const
QString name () const
const Package * package () const
virtual void paintInterface (QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect)
void paintWindowFrame (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
QString pluginName () const
QPoint popupPosition (const QSize &s) const
virtual void removeAssociatedWidget (QWidget *widget)
virtual void restore (KConfigGroup &group)
virtual void save (KConfigGroup &group) const
QRect screenRect () const
void setAspectRatioMode (Plasma::AspectRatioMode)
void setBackgroundHints (const BackgroundHints hints)
void setGlobalShortcut (const KShortcut &shortcut)
bool shouldConserveResources () const
int type () const
void updateConstraints (Plasma::Constraints constraints=Plasma::AllConstraints)
QGraphicsView * view () const
 ~Applet ()

Static Public Member Functions

static QString category (const QString &appletName)
static QString category (const KPluginInfo &applet)
static KPluginInfo::List listAppletInfo (const QString &category=QString(), const QString &parentApp=QString())
static KPluginInfo::List listAppletInfoForMimetype (const QString &mimetype)
static QStringList listCategories (const QString &parentApp=QString(), bool visibleOnly=true)
static Applet * load (const KPluginInfo &info, uint appletId=0, const QVariantList &args=QVariantList())
static Applet * load (const QString &name, uint appletId=0, const QVariantList &args=QVariantList())
static PackageStructure::Ptr packageStructure ()

Protected Member Functions

 Applet (QObject *parent, const QVariantList &args)
virtual void constraintsEvent (Plasma::Constraints constraints)
virtual void createConfigurationInterface (KConfigDialog *parent)
bool eventFilter (QObject *o, QEvent *e)
Extender * extender () const
void focusInEvent (QFocusEvent *event)
void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
bool isRegisteredAsDragHandle (QGraphicsItem *item)
QVariant itemChange (GraphicsItemChange change, const QVariant &value)
void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
void registerAsDragHandle (QGraphicsItem *item)
void resizeEvent (QGraphicsSceneResizeEvent *event)
virtual void saveState (KConfigGroup &config) const
bool sceneEventFilter (QGraphicsItem *watched, QEvent *event)
void setConfigurationRequired (bool needsConfiguring, const QString &reason=QString())
void setFailedToLaunch (bool failed, const QString &reason=QString())
void setHasConfigurationInterface (bool hasInterface)
QPainterPath shape () const
QSizeF sizeHint (Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const
void timerEvent (QTimerEvent *event)
void unregisterAsDragHandle (QGraphicsItem *item)

Properties

QString category
bool configurationRequired
QRectF geometry
bool hasConfigurationInterface
bool hasFailedToLaunch
ImmutabilityType immutability
bool isBusy
QString name
bool shouldConserveResources

Detailed Description

The base Applet class.

Applet provides several important roles for add-ons widgets in Plasma.

First, it is the base class for the plugin system and therefore is the interface to applets for host applications. It also handles the life time management of data engines (e.g. all data engines accessed via Applet::dataEngine(const QString&) are properly deref'd on Applet destruction), background painting (allowing for consistent and complex look and feel in just one line of code for applets), loading and starting of scripting support for each applet, providing access to the associated plasmoid package (if any) and access to configuration data.

See techbase.kde.org for tutorial on writing Applets using this class.

Definition at line 77 of file applet.h.


Member Typedef Documentation

typedef QHash<QString, Applet*> Plasma::Applet::Dict

Definition at line 92 of file applet.h.

typedef QList<Applet*> Plasma::Applet::List

Definition at line 91 of file applet.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
Type 

Definition at line 493 of file applet.h.

enum Plasma::Applet::BackgroundHint

Description on how draw a background for the applet.

Enumerator:
NoBackground  Not drawing a background under the applet, the applet has its own implementation.
StandardBackground  The standard background from the theme is drawn.
TranslucentBackground  An alternate version of the background is drawn, usually more translucent.
DefaultBackground  Default settings: both standard background.

Definition at line 97 of file applet.h.


Constructor & Destructor Documentation

Plasma::Applet::~Applet (  ) 

Definition at line 136 of file applet.cpp.

Plasma::Applet::Applet ( QGraphicsItem *  parent = 0,
const QString &  serviceId = QString(),
uint  appletId = 0 
) [explicit]

Parameters:
parent the QGraphicsItem this applet is parented to
serviceId the name of the .desktop file containing the information about the widget
appletId a unique id used to differentiate between multiple instances of the same Applet type

Definition at line 97 of file applet.cpp.

Plasma::Applet::Applet ( QObject *  parent,
const QVariantList &  args 
) [protected]

This constructor is to be used with the plugin loading systems found in KPluginInfo and KService.

The argument list is expected to have two elements: the KService service ID for the desktop entry and an applet ID which must be a base 10 number.

Parameters:
parent a QObject parent; you probably want to pass in 0
args a list of strings containing two entries: the service id and the applet id

Definition at line 108 of file applet.cpp.


Member Function Documentation

QAction * Plasma::Applet::action ( QString  name  )  const

Returns the QAction with the given name from our collection.

Definition at line 1050 of file applet.cpp.

void Plasma::Applet::activate (  )  [signal]

Emitted when activation is requested due to, for example, a global keyboard shortcut.

By default the wiget is given focus.

void Plasma::Applet::addAction ( QString  name,
QAction *  action 
)

Adds the action to our collection under the given name.

Definition at line 1055 of file applet.cpp.

void Plasma::Applet::addAssociatedWidget ( QWidget *  widget  )  [virtual]

associate actions with this widget, including ones added after this call.

needed to make keyboard shortcuts work.

Reimplemented in Plasma::Containment.

Definition at line 1211 of file applet.cpp.

Plasma::AspectRatioMode Plasma::Applet::aspectRatioMode (  )  const

Returns:
the preferred aspect ratio mode for placement and resizing

Definition at line 1234 of file applet.cpp.

Applet::BackgroundHints Plasma::Applet::backgroundHints (  )  const

Returns:
BackgroundHints flags combination telling if the standard background is shown and if it has a drop shadow

Definition at line 737 of file applet.cpp.

QString Plasma::Applet::category (  )  const

Returns the category the applet is in, as specified in the .desktop file.

QString Plasma::Applet::category ( const QString &  appletName  )  [static]

Get the category of the given applet.

Parameters:
appletName the name of the applet

Definition at line 693 of file applet.cpp.

QString Plasma::Applet::category ( const KPluginInfo &  applet  )  [static]

Get the category of the given applet.

Parameters:
applet a KPluginInfo object for the applet

Definition at line 688 of file applet.cpp.

KConfigGroup Plasma::Applet::config ( const QString &  group  )  const

Returns a config group with the name provided.

This ensures that the group name is properly namespaced to avoid collision with other applets that may be sharing this config file

Parameters:
group the name of the group to access

Definition at line 344 of file applet.cpp.

KConfigGroup Plasma::Applet::config (  )  const

Returns the KConfigGroup to access the applets configuration.

This config object will write to an instance specific config file named <appletname><instanceid>rc in the Plasma appdata directory.

Definition at line 350 of file applet.cpp.

void Plasma::Applet::configChanged (  )  [virtual, slot]

Called when applet configuration values has changed.

Definition at line 1502 of file applet.cpp.

void Plasma::Applet::configNeedsSaving (  )  [signal]

Emitted when an applet has changed values in its configuration and wishes for them to be saved at the next save point.

As this implies disk activity, this signal should be used with care.

Note:
This does not need to be emitted from saveState by individual applets.

ConfigLoader * Plasma::Applet::configScheme (  )  const

Returns the config skeleton object from this applet's package, if any.

Returns:
config skeleton object, or 0 if none

Definition at line 499 of file applet.cpp.

bool Plasma::Applet::configurationRequired (  )  const

Returns:
true if the applet currently needs to be configured, otherwise, false

void Plasma::Applet::constraintsEvent ( Plasma::Constraints  constraints  )  [protected, virtual]

Definition at line 577 of file applet.cpp.

Containment * Plasma::Applet::containment (  )  const

Returns:
the Containment, if any, this applet belongs to

Definition at line 1150 of file applet.cpp.

Context * Plasma::Applet::context (  )  const

Returns the workspace context which the applet is operating in.

Definition at line 1227 of file applet.cpp.

QList< QAction * > Plasma::Applet::contextualActions (  )  [virtual]

Returns a list of context-related QAction instances.

This is used e.g. within the DesktopView to display a contextmenu.

Returns:
A list of actions. The default implementation returns an empty list.

Definition at line 1044 of file applet.cpp.

void Plasma::Applet::createConfigurationInterface ( KConfigDialog *  parent  )  [protected, virtual]

Reimplement this method so provide a configuration interface, parented to the supplied widget.

Ownership of the widgets is passed to the parent widget.

Parameters:
parent the dialog which is the parent of the configuration widgets

Definition at line 1509 of file applet.cpp.

DataEngine * Plasma::Applet::dataEngine ( const QString &  name  )  const

Loads the given DataEngine.

Tries to load the data engine given by name. Each engine is only loaded once, and that instance is re-used on all subsequent requests.

If the data engine was not found, an invalid data engine is returned (see DataEngine::isValid()).

Note that you should not delete the returned engine.

Parameters:
name Name of the data engine to load
Returns:
pointer to the data engine if it was loaded, or an invalid data engine if the requested engine could not be loaded

Definition at line 504 of file applet.cpp.

void Plasma::Applet::destroy (  )  [virtual, slot]

Destroys the applet; it will be removed nicely and deleted.

Its configuration will also be deleted.

Reimplemented in Plasma::Containment.

Definition at line 375 of file applet.cpp.

bool Plasma::Applet::destroyed (  )  const

Returns:
true if destroy() was called; useful for Applets which should avoid certain tasks if they are about to be deleted permanently

Definition at line 398 of file applet.cpp.

bool Plasma::Applet::eventFilter ( QObject *  o,
QEvent *  e 
) [protected]

For internal use only.

event filter; used for focus watching

Reimplemented in Plasma::PopupApplet.

Definition at line 1309 of file applet.cpp.

Extender * Plasma::Applet::extender (  )  const [protected]

Returns:
the extender of this applet.

Definition at line 600 of file applet.cpp.

void Plasma::Applet::flushPendingConstraintsEvents (  )  [slot]

Sends all pending contraints updates to the applet.

Will usually be called automatically, but can also be called manually if needed.

Definition at line 886 of file applet.cpp.

void Plasma::Applet::focusInEvent ( QFocusEvent *  event  )  [protected]

Reimplemented from QGraphicsItem.

Definition at line 1364 of file applet.cpp.

QFont Plasma::Applet::font (  )  const

Returns:
the font currently set for this widget

Definition at line 651 of file applet.cpp.

FormFactor Plasma::Applet::formFactor (  )  const [virtual]

Returns the current form factor the applet is being displayed in.

See also:
Plasma::FormFactor

Definition at line 1144 of file applet.cpp.

void Plasma::Applet::geometryChanged (  )  [signal]

Emitted whenever the applet makes a geometry change, so that views can coordinate themselves with these changes if they desire.

KConfigGroup Plasma::Applet::globalConfig (  )  const

Returns a KConfigGroup object to be shared by all applets of this type.

This config object will write to an applet-specific config object named plasma_<appletname>rc in the local config directory.

Definition at line 359 of file applet.cpp.

KShortcut Plasma::Applet::globalShortcut (  )  const

Returns:
the global shortcut associated with this wiget, or an empty shortcut if no global shortcut is associated.

Definition at line 1197 of file applet.cpp.

bool Plasma::Applet::hasConfigurationInterface (  )  const

Returns:
true if this plasmoid provides a GUI configuration

bool Plasma::Applet::hasFailedToLaunch (  )  const

If for some reason, the applet fails to get up on its feet (the library couldn't be loaded, necessary hardware support wasn't found, etc.

.) this method returns true

void Plasma::Applet::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event  )  [protected]

Reimplemented from QGraphicsLayoutItem.

Definition at line 1732 of file applet.cpp.

void Plasma::Applet::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event  )  [protected]

Reimplemented from QGraphicsLayoutItem.

Definition at line 1737 of file applet.cpp.

QString Plasma::Applet::icon (  )  const

Returns the icon related to this applet.

Definition at line 656 of file applet.cpp.

uint Plasma::Applet::id (  )  const

Returns:
the id of this applet

Definition at line 176 of file applet.cpp.

ImmutabilityType Plasma::Applet::immutability (  )  const

Returns:
The type of immutability of this applet

void Plasma::Applet::init (  )  [virtual, slot]

This method is called once the applet is loaded and added to a Corona.

If the applet requires a QGraphicsScene or has an particularly intensive set of initialization routines to go through, consider implementing it in this method instead of the constructor.

Note: paintInterface may get called before init() depending on initialization order. Painting is managed by the canvas (QGraphisScene), and may schedule a paint event prior to init() being called.

Reimplemented in Plasma::Containment.

Definition at line 169 of file applet.cpp.

void Plasma::Applet::initExtenderItem ( ExtenderItem *  item  )  [virtual]

Gets called when and extender item has to be initialized after a plasma restart.

If you create ExtenderItems in your applet, you should implement this function to again create the widget that should be shown in this extender item. This function might look something like this:

 SuperCoolWidget *widget = new SuperCoolWidget();
 dataEngine("engine")->connectSource(item->config("dataSourceName"), widget);
 item->setWidget(widget);

You can also add one or more custom qactions to this extender item in this function.

Note that by default, not all ExtenderItems are persistent. Only items that are detached, will have their configuration stored when plasma exits.

Definition at line 591 of file applet.cpp.

bool Plasma::Applet::isBusy (  )  const

Returns:
true if the applet is busy and is showing an indicator widget for that

bool Plasma::Applet::isContainment (  )  const

Returns:
true if this Applet is currently being used as a Containment, false otherwise

Definition at line 1818 of file applet.cpp.

bool Plasma::Applet::isPopupShowing (  )  const [virtual]

Returns:
true is there is a popup assoiated with this Applet showing, such as the dialog of a PopupApplet. May be reimplemented for custom popup implementations.

Reimplemented in Plasma::PopupApplet.

Definition at line 1206 of file applet.cpp.

bool Plasma::Applet::isRegisteredAsDragHandle ( QGraphicsItem *  item  )  [protected]

Parameters:
item the item to look for if it is registered or not
Returns:
true if it is registered, false otherwise

Definition at line 1265 of file applet.cpp.

QVariant Plasma::Applet::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
) [protected]

Reimplemented from QGraphicsItem.

Reimplemented in Plasma::Containment.

Definition at line 1657 of file applet.cpp.

KPluginInfo::List Plasma::Applet::listAppletInfo ( const QString &  category = QString(),
const QString &  parentApp = QString() 
) [static]

Returns a list of all known applets.

Parameters:
category Only applets matchin this category will be returned. Useful in conjunction with knownCategories. If "Misc" is passed in, then applets without a Categories= entry are also returned. If an empty string is passed in, all applets are returned.
parentApp the application to filter applets on. Uses the X-KDE-ParentApp entry (if any) in the plugin info. The default value of QString() will result in a list containing only applets not specifically registered to an application.
Returns:
list of applets

Definition at line 1516 of file applet.cpp.

KPluginInfo::List Plasma::Applet::listAppletInfoForMimetype ( const QString &  mimetype  )  [static]

Returns a list of all known applets associated with a certain mimetype.

Returns:
list of applets

Definition at line 1544 of file applet.cpp.

QStringList Plasma::Applet::listCategories ( const QString &  parentApp = QString(),
bool  visibleOnly = true 
) [static]

Returns a list of all the categories used by installed applets.

Parameters:
parentApp the application to filter applets on. Uses the X-KDE-ParentApp entry (if any) in the plugin info. The default value of QString() will result in a list containing only applets not specifically registered to an application.
Returns:
list of categories
Parameters:
visibleOnly true if it should only return applets that are marked as visible

Definition at line 1552 of file applet.cpp.

Applet * Plasma::Applet::load ( const KPluginInfo &  info,
uint  appletId = 0,
const QVariantList &  args = QVariantList() 
) [static]

Attempts to load an applet.

Returns a pointer to the applet if successful. The caller takes responsibility for the applet, including deleting it when no longer needed.

Parameters:
info KPluginInfo object for the desired applet
appletId unique ID to assign the applet, or zero to have one assigned automatically.
args to send the applet extra arguments
Returns:
a pointer to the loaded applet, or 0 on load failure

Definition at line 1648 of file applet.cpp.

Applet * Plasma::Applet::load ( const QString &  name,
uint  appletId = 0,
const QVariantList &  args = QVariantList() 
) [static]

Attempts to load an applet.

Returns a pointer to the applet if successful. The caller takes responsibility for the applet, including deleting it when no longer needed.

Parameters:
name the plugin name, as returned by KPluginInfo::pluginName()
appletId unique ID to assign the applet, or zero to have one assigned automatically.
args to send the applet extra arguments
Returns:
a pointer to the loaded applet, or 0 on load failure

Definition at line 1585 of file applet.cpp.

Location Plasma::Applet::location (  )  const [virtual]

Returns the location of the scene which is displaying applet.

See also:
Plasma::Location

Definition at line 1221 of file applet.cpp.

void Plasma::Applet::lower (  )  [slot]

Causes this applet to lower below all the other applets.

Definition at line 1793 of file applet.cpp.

QRectF Plasma::Applet::mapFromView ( const QGraphicsView *  view,
const QRect &  rect 
) const

Maps a QRect from a view's coordinates to local coordinates.

Parameters:
view the view from which rect should be mapped
rect the rect to be mapped

Definition at line 553 of file applet.cpp.

QRect Plasma::Applet::mapToView ( const QGraphicsView *  view,
const QRectF &  rect 
) const

Maps a QRectF from local coordinates to a view's coordinates.

Parameters:
view the view to which rect should be mapped
rect the rect to be mapped

Definition at line 559 of file applet.cpp.

void Plasma::Applet::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

For internal use only.

manage the mouse movement to drag the applet around

Reimplemented in Plasma::Containment.

Definition at line 1338 of file applet.cpp.

QString Plasma::Applet::name (  )  const

Returns the user-visible name for the applet, as specified in the .desktop file.

Returns:
the user-visible name for the applet.

const Package * Plasma::Applet::package (  )  const

Accessor for the associated Package object if any.

Generally, only Plasmoids come in a Package.

Returns:
the Package object, or 0 if none

Definition at line 519 of file applet.cpp.

PackageStructure::Ptr Plasma::Applet::packageStructure (  )  [static]

Returns:
a package structure representing a Theme

Definition at line 160 of file applet.cpp.

void Plasma::Applet::paintInterface ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
const QRect &  contentsRect 
) [virtual]

This method is called when the interface should be painted.

Parameters:
painter the QPainter to use to do the paintiner
option the style options object
contentsRect the rect to paint within; automatically adjusted for the background, if any

Definition at line 1135 of file applet.cpp.

void Plasma::Applet::paintWindowFrame ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)

Reimplemented from QGraphicsWidget.

Definition at line 807 of file applet.cpp.

QString Plasma::Applet::pluginName (  )  const

Returns the plugin name for the applet.

Definition at line 665 of file applet.cpp.

QPoint Plasma::Applet::popupPosition ( const QSize &  s  )  const

Reccomended position for a popup window like a menu or a tooltip given its size.

Parameters:
s size of the popup
Returns:
reccomended position

Definition at line 565 of file applet.cpp.

void Plasma::Applet::raise (  )  [slot]

Causes this applet to raise above all other applets.

Definition at line 1788 of file applet.cpp.

void Plasma::Applet::registerAsDragHandle ( QGraphicsItem *  item  )  [protected]

Register the widgets that manage mouse clicks but you still want to be able to drag the applet around when holding the mouse pointer on that widget.

Calling this results in an eventFilter being places on the widget.

Parameters:
item the item to watch for mouse move

Definition at line 1244 of file applet.cpp.

void Plasma::Applet::releaseVisualFocus (  )  [signal]

This signal indicates that an application launch, window creation or window focus event was triggered.

This is used, for instance, to ensure that the Dashboard view in Plasma hides when such an event is triggered by an item it is displaying.

void Plasma::Applet::removeAssociatedWidget ( QWidget *  widget  )  [virtual]

un-associate actions from this widget, including ones added after this call.

needed to make keyboard shortcuts work.

Reimplemented in Plasma::Containment.

Definition at line 1216 of file applet.cpp.

void Plasma::Applet::resizeEvent ( QGraphicsSceneResizeEvent *  event  )  [protected]

Reimplemented from QGraphicsItem.

Reimplemented from QGraphicsWidget.

Reimplemented in Plasma::Containment.

Definition at line 1374 of file applet.cpp.

void Plasma::Applet::restore ( KConfigGroup &  group  )  [virtual]

Restores state information about this applet saved previously in save(KConfigGroup&).

This method does not need to be reimplmented by Applet subclasses, but can be useful for Applet specializations (such as Containment) to do so.

Reimplemented in Plasma::Containment.

Definition at line 234 of file applet.cpp.

void Plasma::Applet::save ( KConfigGroup &  group  )  const [virtual]

Saves state information about this applet that will be accessed when next instantiated in the restore(KConfigGroup&) method.

This method does not need to be reimplmented by Applet subclasses, but can be useful for Applet specializations (such as Containment) to do so.

Applet subclasses may instead want to reimplement saveState().

Reimplemented in Plasma::Containment.

Definition at line 181 of file applet.cpp.

void Plasma::Applet::saveState ( KConfigGroup &  config  )  const [protected, virtual]

When called, the Applet should write any information needed as part of the Applet's running state to the configuration object in config() and/or globalConfig().

Applets that always sync their settings/state with the config objects when these settings/states change do not need to reimplement this method.

Definition at line 334 of file applet.cpp.

bool Plasma::Applet::sceneEventFilter ( QGraphicsItem *  watched,
QEvent *  event 
) [protected]

For internal use only.

scene event filter; used to manage applet dragging

Reimplemented in Plasma::Containment.

Definition at line 1314 of file applet.cpp.

QRect Plasma::Applet::screenRect (  )  const

This method returns screen coordinates for the widget; this method can be somewhat expensive and should ONLY be called when screen coordinates are required.

For example when positioning top level widgets on top of the view to create the appearance of unit. This should NOT be used for popups (

See also:
popupPosition) or for normal widget use (use Plasma:: widgets or QGraphicsProxyWidget instead).
Returns:
a rect of the applet in screen coordinates.

Definition at line 1769 of file applet.cpp.

void Plasma::Applet::setAspectRatioMode ( Plasma::AspectRatioMode  mode  ) 

Sets the preferred aspect ratio mode for placement and resizing.

Definition at line 1239 of file applet.cpp.

void Plasma::Applet::setBackgroundHints ( const BackgroundHints  hints  ) 

Sets the BackgroundHints for this applet.

See also:
BackgroundHint
Parameters:
hints the BackgroundHint combination for this applet

Definition at line 742 of file applet.cpp.

void Plasma::Applet::setBusy ( bool  busy  )  [slot]

Shows a busy indicator that overlays the applet.

Parameters:
busy show or hide the busy indicator

Definition at line 609 of file applet.cpp.

void Plasma::Applet::setConfigurationRequired ( bool  needsConfiguring,
const QString &  reason = QString() 
) [protected]

When the applet needs to be configured before being usable, this method can be called to show a standard interface prompting the user to configure the applet.

Parameters:
needsConfiguring true if the applet needs to be configured, or false if it doesn't
reason a translated message for the user explaining that the applet needs configuring; this should note what needs to be configured

Definition at line 823 of file applet.cpp.

void Plasma::Applet::setFailedToLaunch ( bool  failed,
const QString &  reason = QString() 
) [protected]

Call this method when the applet fails to launch properly.

An optional reason can be provided.

Not that all children items will be deleted when this method is called. If you have pointers to these items, you will need to reset them after calling this method.

Parameters:
failed true when the applet failed, false when it succeeded
reason an optional reason to show the user why the applet failed to launch

Definition at line 284 of file applet.cpp.

void Plasma::Applet::setGlobalShortcut ( const KShortcut &  shortcut  ) 

Sets the global shorcut to associate with this widget.

Definition at line 1174 of file applet.cpp.

void Plasma::Applet::setHasConfigurationInterface ( bool  hasInterface  )  [protected]

Sets whether or not this applet provides a user interface for configuring the applet.

It defaults to false, and if true is passed in you should also reimplement createConfigurationInterface()

Parameters:
hasInterface whether or not there is a user interface available

Definition at line 1275 of file applet.cpp.

void Plasma::Applet::setImmutability ( const ImmutabilityType  immutable  )  [slot]

Sets the immutability type for this applet (not immutable, user immutable or system immutable).

  • immutable the new immutability type of this applet

Definition at line 727 of file applet.cpp.

QPainterPath Plasma::Applet::shape (  )  const [protected]

Reimplemented from QGraphicsItem.

Definition at line 1690 of file applet.cpp.

bool Plasma::Applet::shouldConserveResources (  )  const

Whether the applet should conserve resources.

If true, try to avoid doing stuff which is computationally heavy. Try to conserve power and resources.

Returns:
true if it should conserve resources, false if it does not.

void Plasma::Applet::showConfigurationInterface (  )  [virtual, slot]

Lets the user interact with the plasmoid options.

Called when the user selects the configure entry from the context menu.

Unless there is good reason for overriding this method, Applet subclasses should actually override createConfigurationInterface instead. A good example of when this isn't plausible is when using a dialog prepared by another library, such as KPropertiesDialog from libkfile.

Reimplemented in Plasma::Containment.

Definition at line 1388 of file applet.cpp.

QSizeF Plasma::Applet::sizeHint ( Qt::SizeHint  which,
const QSizeF &  constraint = QSizeF() 
) const [protected]

Reimplemented from QGraphicsLayoutItem.

Definition at line 1699 of file applet.cpp.

void Plasma::Applet::sizeHintChanged ( Qt::SizeHint  which  )  [signal]

Emitted by Applet subclasses when they change a sizeHint and wants to announce the change.

void Plasma::Applet::timerEvent ( QTimerEvent *  event  )  [protected]

Reimplemented from QObject.

Definition at line 1742 of file applet.cpp.

int Plasma::Applet::type (  )  const

Reimplemented from QGraphicsItem.

Definition at line 1039 of file applet.cpp.

void Plasma::Applet::unregisterAsDragHandle ( QGraphicsItem *  item  )  [protected]

Unregister a widget registered with registerAsDragHandle.

Parameters:
item the item to unregister

Definition at line 1254 of file applet.cpp.

void Plasma::Applet::updateConstraints ( Plasma::Constraints  constraints = Plasma::AllConstraints  ) 

Called when any of the geometry constraints have been updated.

This method calls constraintsEvent, which may be reimplemented, once the Applet has been prepared for updating the constraints.

Parameters:
constraints the type of constraints that were updated

Definition at line 572 of file applet.cpp.

QGraphicsView * Plasma::Applet::view (  )  const

Returns the view this widget is visible on, or 0 if none can be found.

Warning:
do NOT assume this will always return a view! a null view probably means that either plasma isn't finished loading, or your applet is on an activity that's not being shown anywhere.

Definition at line 524 of file applet.cpp.


Property Documentation

QString Plasma::Applet::category [read]

Definition at line 82 of file applet.h.

bool Plasma::Applet::configurationRequired [read, write]

Definition at line 86 of file applet.h.

QRectF Plasma::Applet::geometry [read, write]

Definition at line 87 of file applet.h.

bool Plasma::Applet::hasConfigurationInterface [read]

Definition at line 80 of file applet.h.

bool Plasma::Applet::hasFailedToLaunch [read, write]

Definition at line 84 of file applet.h.

ImmutabilityType Plasma::Applet::immutability [read, write]

Definition at line 83 of file applet.h.

bool Plasma::Applet::isBusy [read, write]

Definition at line 85 of file applet.h.

QString Plasma::Applet::name [read]

Definition at line 81 of file applet.h.

bool Plasma::Applet::shouldConserveResources [read]

Definition at line 88 of file applet.h.


The documentation for this class was generated from the following files:
  • applet.h
  • applet.cpp

Plasma

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal