#include <appletinterface.h>

Inheritance diagram for AppletInterface:


int apiVersion
QString associatedApplication
QList< QUrlassociatedApplicationUrls
QRect availableScreenRect
QVariantList availableScreenRegion
Plasma::Types::BackgroundHints backgroundHints
bool busy
QObject configuration
bool configurationRequired
QString configurationRequiredReason
Plasma::Types::ConstraintHints constraintHints
QString currentActivity
Plasma::Types::BackgroundHints effectiveBackgroundHints
Plasma::Types::FormFactor formFactor
QKeySequence globalShortcut
bool hideOnWindowDeactivate
QString icon
uint id
Plasma::Types::ImmutabilityType immutability
bool immutable
bool loading
Plasma::Types::Location location
KPluginMetaData metaData
QObject nativeInterface
QString pluginName
int screen
QRect screenGeometry
Plasma::Types::ItemStatus status
QString title
QQuickItem toolTipItem
QString toolTipMainText
QString toolTipSubText
int toolTipTextFormat
Plasma::Types::BackgroundHints userBackgroundHints
bool userConfiguring


void activated ()
void associatedApplicationChanged ()
void associatedApplicationUrlsChanged ()
void availableScreenRectChanged ()
void availableScreenRegionChanged ()
void backgroundHintsChanged ()
void busyChanged ()
void configNeedsSaving ()
void configurationRequiredChanged ()
void configurationRequiredReasonChanged ()
void constraintHintsChanged ()
void contextChanged ()
void contextualActionsAboutToShow ()
void effectiveBackgroundHintsChanged ()
void externalData (const QString &mimetype, const QVariant &data)
void formFactorChanged ()
void globalShortcutChanged ()
void hideOnWindowDeactivateChanged ()
void iconChanged ()
void immutabilityChanged ()
void isLoadingChanged ()
void locationChanged ()
void screenChanged ()
void screenGeometryChanged ()
void statusChanged ()
void titleChanged ()
void toolTipItemChanged ()
void toolTipMainTextChanged ()
void toolTipSubTextChanged ()
void toolTipTextFormatChanged ()
void userBackgroundHintsChanged ()
void userConfiguringChanged ()

Public Member Functions

 AppletInterface (DeclarativeAppletScript *script, const QVariantList &args=QVariantList(), QQuickItem *parent=nullptr)
Q_INVOKABLE QActionaction (QString name) const
int apiVersion () const
DeclarativeAppletScript * appletScript () const
QString associatedApplication () const
QList< QUrlassociatedApplicationUrls () const
QRect availableScreenRect () const
QVariantList availableScreenRegion () const
Plasma::Types::BackgroundHints backgroundHints () const
Q_INVOKABLE void clearActions ()
QObjectconfiguration () const
bool configurationRequired () const
QString configurationRequiredReason () const
Plasma::Types::ConstraintHints constraintHints () const
QList< QAction * > contextualActions () const
QString currentActivity () const
Q_INVOKABLE QStringList downloadedFiles () const
Q_INVOKABLE QString downloadPath () const
Q_INVOKABLE PLASMA_DEPRECATED QString downloadPath (const QString &file)
Plasma::Types::BackgroundHints effectiveBackgroundHints () const
void executeAction (const QString &name)
Q_INVOKABLE QString file (const QString &fileName)
Q_INVOKABLE QString file (const QString &fileType, const QString &filePath)
Plasma::Types::FormFactor formFactor () const
QKeySequence globalShortcut () const
bool hideOnWindowDeactivate () const
QString icon () const
uint id () const
Plasma::Types::ImmutabilityType immutability () const
bool immutable () const
bool isBusy () const
Plasma::Types::Location location () const
KPluginMetaData metaData () const
QObjectnativeInterface ()
QString pluginName () const
Q_INVOKABLE void prepareContextualActions ()
Q_INVOKABLE void removeAction (const QString &name)
int screen () const
QRect screenGeometry () const
Q_INVOKABLE void setAction (const QString &name, const QString &text, const QString &icon=QString(), const QString &shortcut=QString())
Q_INVOKABLE void setActionSeparator (const QString &name)
void setAssociatedApplication (const QString &string)
void setAssociatedApplicationUrls (const QList< QUrl > &urls)
void setBackgroundHints (Plasma::Types::BackgroundHints hint)
void setBusy (bool busy)
Q_INVOKABLE void setConfigurationRequired (bool needsConfiguring, const QString &reason=QString())
void setConfigurationRequiredProperty (bool required)
void setConfigurationRequiredReason (const QString &reason)
void setConstraintHints (Plasma::Types::ConstraintHints constraintHints)
void setGlobalShortcut (const QKeySequence &keySequence)
void setHideOnWindowDeactivate (bool hide)
void setIcon (const QString &icon)
void setStatus (const Plasma::Types::ItemStatus &status)
void setTitle (const QString &title)
void setToolTipItem (QQuickItem *toolTipItem)
void setToolTipMainText (const QString &text)
void setToolTipSubText (const QString &text)
void setToolTipTextFormat (int format)
void setUserBackgroundHints (Plasma::Types::BackgroundHints hint)
Plasma::Types::ItemStatus status () const
QString title () const
QQuickItemtoolTipItem () const
QString toolTipMainText () const
QString toolTipSubText () const
int toolTipTextFormat () const
Plasma::Types::BackgroundHints userBackgroundHints () const
bool userConfiguring () const

Static Public Member Functions

static AppletInterfaceqmlAttachedProperties (QObject *object)

Protected Slots

void init () override

Protected Member Functions

bool event (QEvent *event) override
bool eventFilter (QObject *watched, QEvent *event) override
virtual bool isLoading () const
void updateUiReadyConstraint ()

Detailed Description

This class is exposed to applets in QML as the attached property Plasmoid.

@import org.kde.plasma.Plasmoid

Definition at line 45 of file appletinterface.h.

Property Documentation

int AppletInterface::apiVersion

The QML root object defined in the applet main.qml will be direct child of an AppletInterface instance.

Version of the QML2 script engine

Definition at line 56 of file appletinterface.h.

QString AppletInterface::associatedApplication

Sets the associated application of this plasmoid, if the plasmoid is representing the "compact" view for some application or for some document type.

Definition at line 179 of file appletinterface.h.

QList< QUrl > AppletInterface::associatedApplicationUrls

Sets the associated application of this plasmoid, if the plasmoid is representing the "compact" view for some application or for some document type.

Definition at line 184 of file appletinterface.h.

QRect AppletInterface::availableScreenRect

screen area free of panels: the coordinates are relative to the containment, it's independent from the screen position For more precise available geometry use availableScreenRegion()

Definition at line 233 of file appletinterface.h.

QVariantList AppletInterface::availableScreenRegion

The available region of this screen, panels excluded.

It's a list of rectangles

Definition at line 238 of file appletinterface.h.

Plasma::Types::BackgroundHints AppletInterface::backgroundHints

How the applet wants its background to be drawn.

The containment may chose to ignore this hint.

Definition at line 137 of file appletinterface.h.

bool AppletInterface::busy

When true the plasmoid is busy.

The containment may graphically indicate that drawing for instance a spinner busy widget over it

Definition at line 132 of file appletinterface.h.

QObject * AppletInterface::configuration

Configuration object: each config key will be a writable property of this object.

property bindings work.

Definition at line 127 of file appletinterface.h.

bool AppletInterface::configurationRequired

If true the applet requires manual configuration from the user.

Definition at line 221 of file appletinterface.h.

QString AppletInterface::configurationRequiredReason

Reason why the manual user configuration is required.

Definition at line 226 of file appletinterface.h.

Plasma::Types::ConstraintHints AppletInterface::constraintHints

When false the plasmoid will ignore the margins when contained in a panel.

Definition at line 245 of file appletinterface.h.

QString AppletInterface::currentActivity

Current activity name the plasmoid is in.

Definition at line 122 of file appletinterface.h.

Plasma::Types::BackgroundHints AppletInterface::effectiveBackgroundHints

The effective background hints the applet has, internally decided how to mix with userBackgroundHints.

Definition at line 147 of file appletinterface.h.

Plasma::Types::FormFactor AppletInterface::formFactor

FormFactor for the plasmoid.

Definition at line 112 of file appletinterface.h.

QKeySequence AppletInterface::globalShortcut

The global shortcut to activate the plasmoid.

This is typically only used by the default configuration module

Definition at line 211 of file appletinterface.h.

bool AppletInterface::hideOnWindowDeactivate

Whether the dialog should be hidden when the dialog loses focus.

The default value is false.

Definition at line 203 of file appletinterface.h.

QString AppletInterface::icon

Icon to represent the plasmoid.

Definition at line 102 of file appletinterface.h.

uint AppletInterface::id

Applet id: is unique in the whole Plasma session and will never change across restarts.

Definition at line 107 of file appletinterface.h.

Plasma::Types::ImmutabilityType AppletInterface::immutability

The immutability of the Corona.

Use this if you need more granular control than just using the immutable property

See also

Definition at line 164 of file appletinterface.h.

bool AppletInterface::immutable

Whether the Corona is immutable.

The plasmoid implementation should avoid allowing "dangerous" modifications from the user when in an immutable mode

This is true when immutability is not Mutable

Definition at line 154 of file appletinterface.h.

Plasma::Types::Location AppletInterface::location

Location for the plasmoid.

Definition at line 117 of file appletinterface.h.

KPluginMetaData AppletInterface::metaData

The metadata of the applet.


Definition at line 251 of file appletinterface.h.

QObject * AppletInterface::nativeInterface

An interface to the native C++ plasmoid, if implemented.

Definition at line 216 of file appletinterface.h.

QString AppletInterface::pluginName

Plugin name of the plasmoid.

Definition at line 61 of file appletinterface.h.

QRect AppletInterface::screenGeometry

Provides access to the geometry of the applet is in.

Can be useful to figure out what's the absolute position of the applet.

Definition at line 196 of file appletinterface.h.

Plasma::Types::ItemStatus AppletInterface::status

Status of the plasmoid: useful to instruct the shell if this plasmoid is requesting attention, if is accepting input, or if is in an idle, inactive state.

Definition at line 174 of file appletinterface.h.

QString AppletInterface::title

User friendly title for the plasmoid: it's the localized applet name by default.

Definition at line 66 of file appletinterface.h.

QQuickItem * AppletInterface::toolTipItem

This allows to set custom full QML items as the tooltip.

It will ignore all texts set by setToolTipMainText or setToolTipSubText


Definition at line 96 of file appletinterface.h.

QString AppletInterface::toolTipMainText

Main title for the plasmoid tooltip or other means of quick information: it's the same as the title property by default, but it can be personalized.

Definition at line 72 of file appletinterface.h.

QString AppletInterface::toolTipSubText

Description for the plasmoid tooltip or other means of quick information: it comes from the pluginifo comment by default, but it can be personalized.

Definition at line 78 of file appletinterface.h.

int AppletInterface::toolTipTextFormat

how to handle the text format of the tooltip subtext:

  • Text.AutoText (default)
  • Text.PlainText
  • Text.StyledText
  • Text.RichText Note: in the default implementation the main text is always plain text

Definition at line 88 of file appletinterface.h.

Plasma::Types::BackgroundHints AppletInterface::userBackgroundHints

The containment (and/or the user) may decide to use another kind of background instead (if supported by the applet)

Definition at line 142 of file appletinterface.h.

bool AppletInterface::userConfiguring

True when the user is configuring, for instance when the configuration dialog is open.

Definition at line 169 of file appletinterface.h.

Member Function Documentation

void AppletInterface::activated ( )

Emitted when the applet's activation action is triggered.

void AppletInterface::contextualActionsAboutToShow ( )

Emitted just before the contextual actions are about to show For instance just before the context menu containing the actions added with setAction() is shown.

QStringList AppletInterface::downloadedFiles ( ) const
The list of files that have been downloaded

Definition at line 678 of file appletinterface.cpp.

QString AppletInterface::downloadPath ( ) const
A path where it is safe to write on disk downloaded files.

Definition at line 666 of file appletinterface.cpp.

QString AppletInterface::downloadPath ( const QString file)
A path where it is safe to write on disk downloaded files.
filethat name of the file to download (unused).
Since 5,23, use downloadPath() instead.

Definition at line 660 of file appletinterface.cpp.

void AppletInterface::externalData ( const QString mimetype,
const QVariant data 

somebody else, usually the containment sent some data to the applet

mimetypethe mime type of the data such as text/plain
dataeither the actual data or an URL representing it
QString AppletInterface::file ( const QString fileName)

FIXME: remove? Retrieve the path of a file from the Plasmoid package.

fileNamethe package-recognized name, such as "mainscript"
the full absolute path of the file, if found, an empty string if not

Definition at line 412 of file appletinterface.cpp.

QString AppletInterface::file ( const QString fileType,
const QString filePath 

FIXME: remove? Retrieve the path of a file from the Plasmoid package.

fileTypethe type supported from the package, such as "ui", "config" or "image"
filePaththe name of the file, such as "foo.qml" or "bar.png"
the full absolute path of the file, if found, an empty string if not

Definition at line 417 of file appletinterface.cpp.

void AppletInterface::prepareContextualActions ( )

Should be called before retrieving any action to ensure contents are up to date.

See also

Definition at line 809 of file appletinterface.cpp.

void AppletInterface::setAction ( const QString name,
const QString text,
const QString icon = QString(),
const QString shortcut = QString() 

Add an action to the Plasmoid contextual menu.

When the action is triggered a function called action_<name> will be called, if there is no function with that name actionTriggered(name) will be called instead.


Definition at line 456 of file appletinterface.cpp.

void AppletInterface::setConfigurationRequired ( bool  needsConfiguring,
const QString reason = QString() 

Set this to true if the plasmoid needs to be configured in order to work.

The containment will display reason as a message to ask the user to configure.

needsConfiguringIf the plasmoid needs configuration
reasonThe user readable (and localized) reason the plasmoid needs

Definition at line 407 of file appletinterface.cpp.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Oct 22 2020 22:45:34 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.