7#include "appletquickitem.h" 
    9#include "appletcontext_p.h" 
   10#include "appletquickitem_p.h" 
   11#include "configview.h" 
   12#include "containment.h" 
   14#include "plasma_version.h" 
   15#include "plasmoid/containmentitem.h" 
   16#include "plasmoid/plasmoiditem.h" 
   17#include "plasmoid/wallpaperitem.h" 
   18#include "plasmoidattached_p.h" 
   19#include "sharedqmlengine.h" 
   23#include <QQmlExpression> 
   24#include <QQmlProperty> 
   25#include <QQuickWindow> 
   26#include <QRandomGenerator> 
   30#include <KLocalizedString> 
   32#include <Plasma/Applet> 
   33#include <Plasma/Containment> 
   34#include <Plasma/Corona> 
   35#include <qquickitem.h> 
   40QHash<Plasma::Applet *, AppletQuickItem *> AppletQuickItemPrivate::s_itemsForApplet = QHash<Plasma::Applet *, AppletQuickItem *>();
 
   41AppletQuickItemPrivate::PreloadPolicy AppletQuickItemPrivate::s_preloadPolicy = AppletQuickItemPrivate::Uninitialized;
 
   43AppletQuickItemPrivate::AppletQuickItemPrivate(AppletQuickItem *item)
 
   48    , compactRepresentationCheckGuard(false)
 
   50    if (s_preloadPolicy == Uninitialized) {
 
   52        s_preloadPolicy = Adaptive;
 
   54        if (qEnvironmentVariableIsSet(
"PLASMA_PRELOAD_POLICY")) {
 
   55            const QString policy = qEnvironmentVariable(
"PLASMA_PRELOAD_POLICY");
 
   57                s_preloadPolicy = Aggressive;
 
   59                s_preloadPolicy = 
None;
 
   63        qCInfo(LOG_PLASMAQUICK) << 
"Applet preload policy set to" << s_preloadPolicy;
 
   67int AppletQuickItemPrivate::preloadWeight()
 const 
   74        defaultWeight = DefaultLauncherPreloadWeight;
 
   76        defaultWeight = DefaultPreloadWeight;
 
   81        applet->config().readEntry(QStringLiteral(
"PreloadWeight"), qMax(defaultWeight, applet->pluginMetaData().value(u
"X-Plasma-PreloadWeight", 0))),
 
   85QObject *AppletQuickItemPrivate::searchLayoutAttached(
QObject *parent)
 const 
   90    const auto lstChildren = parent->
children();
 
   91    for (
QObject *child : lstChildren) {
 
   94        if (child->property(
"minimumWidth").isValid()
 
   95            && child->property(
"minimumHeight").isValid()
 
   96            && child->property(
"preferredWidth").isValid()
 
   97            && child->property(
"preferredHeight").isValid()
 
   98            && child->property(
"maximumWidth").isValid()
 
   99            && child->property(
"maximumHeight").isValid()
 
  100            && child->property(
"fillWidth").isValid()
 
  101            && child->property(
"fillHeight").isValid()) { 
 
  109void AppletQuickItemPrivate::connectLayoutAttached(
QObject *item)
 
  116    QObject *layout = searchLayoutAttached(item);
 
  122            ownLayout->setProperty(
"minimumWidth", 0);
 
  123            ownLayout->setProperty(
"minimumHeight", 0);
 
  124            ownLayout->setProperty(
"preferredWidth", -1);
 
  125            ownLayout->setProperty(
"preferredHeight", -1);
 
  126            ownLayout->setProperty(
"maximumWidth", std::numeric_limits<qreal>::infinity());
 
  127            ownLayout->setProperty(
"maximumHeight", std::numeric_limits<qreal>::infinity());
 
  128            ownLayout->setProperty(
"fillWidth", 
false);
 
  129            ownLayout->setProperty(
"fillHeight", 
false);
 
  135    propagateSizeHint(
"minimumWidth");
 
  136    propagateSizeHint(
"minimumHeight");
 
  137    propagateSizeHint(
"preferredWidth");
 
  138    propagateSizeHint(
"preferredHeight");
 
  139    propagateSizeHint(
"maximumWidth");
 
  140    propagateSizeHint(
"maximumHeight");
 
  141    propagateSizeHint(
"fillWidth");
 
  142    propagateSizeHint(
"fillHeight");
 
  144    QObject *newOwnLayout = searchLayoutAttached(q);
 
  152    if (representationLayout == layout) {
 
  156    if (representationLayout) {
 
  161    QObject::connect(layout, SIGNAL(minimumWidthChanged()), q, SLOT(minimumWidthChanged()));
 
  162    QObject::connect(layout, SIGNAL(minimumHeightChanged()), q, SLOT(minimumHeightChanged()));
 
  164    QObject::connect(layout, SIGNAL(preferredWidthChanged()), q, SLOT(preferredWidthChanged()));
 
  165    QObject::connect(layout, SIGNAL(preferredHeightChanged()), q, SLOT(preferredHeightChanged()));
 
  167    QObject::connect(layout, SIGNAL(maximumWidthChanged()), q, SLOT(maximumWidthChanged()));
 
  168    QObject::connect(layout, SIGNAL(maximumHeightChanged()), q, SLOT(maximumHeightChanged()));
 
  170    QObject::connect(layout, SIGNAL(fillWidthChanged()), q, SLOT(fillWidthChanged()));
 
  171    QObject::connect(layout, SIGNAL(fillHeightChanged()), q, SLOT(fillHeightChanged()));
 
  173    representationLayout = layout;
 
  174    ownLayout = newOwnLayout;
 
  176    propagateSizeHint(
"minimumWidth");
 
  177    propagateSizeHint(
"minimumHeight");
 
  178    propagateSizeHint(
"preferredWidth");
 
  179    propagateSizeHint(
"preferredHeight");
 
  180    propagateSizeHint(
"maximumWidth");
 
  181    propagateSizeHint(
"maximumHeight");
 
  182    propagateSizeHint(
"fillWidth");
 
  183    propagateSizeHint(
"fillHeight");
 
  186void AppletQuickItemPrivate::propagateSizeHint(
const QByteArray &layoutProperty)
 
  188    if (ownLayout && representationLayout) {
 
  189        ownLayout->setProperty(layoutProperty.
constData(), representationLayout->property(layoutProperty.
constData()).toReal());
 
  193QQuickItem *AppletQuickItemPrivate::createCompactRepresentationItem()
 
  195    if (!compactRepresentation) {
 
  199    if (compactRepresentationItem) {
 
  200        return compactRepresentationItem;
 
  203    QVariantHash initialProperties;
 
  207    compactRepresentationItem = qobject_cast<QQuickItem *>(qmlObject->createObjectFromComponent(compactRepresentation, qmlContext(q), initialProperties));
 
  209    Q_EMIT q->compactRepresentationItemChanged(compactRepresentationItem);
 
  211    return compactRepresentationItem;
 
  214QQuickItem *AppletQuickItemPrivate::createFullRepresentationItem()
 
  216    if (fullRepresentationItem) {
 
  217        return fullRepresentationItem;
 
  220    if (fullRepresentation && fullRepresentation != qmlObject->mainComponent()) {
 
  221        QVariantHash initialProperties;
 
  222        initialProperties[QStringLiteral(
"parent")] = 
QVariant();
 
  223        fullRepresentationItem = qobject_cast<QQuickItem *>(qmlObject->createObjectFromComponent(fullRepresentation, qmlContext(q), initialProperties));
 
  226    if (!fullRepresentationItem) {
 
  230    Q_EMIT q->fullRepresentationItemChanged(fullRepresentationItem);
 
  232    return fullRepresentationItem;
 
  235QQuickItem *AppletQuickItemPrivate::createCompactRepresentationExpanderItem()
 
  237    if (!compactRepresentationExpander) {
 
  241    if (compactRepresentationExpanderItem) {
 
  242        return compactRepresentationExpanderItem;
 
  245    compactRepresentationExpanderItem = qobject_cast<QQuickItem *>(qmlObject->createObjectFromComponent(compactRepresentationExpander, qmlContext(q)));
 
  247    if (!compactRepresentationExpanderItem) {
 
  254    return compactRepresentationExpanderItem;
 
  257bool AppletQuickItemPrivate::appletShouldBeExpanded()
 const 
  259    if (applet->isContainment()) {
 
  263        if (!fullRepresentation) {
 
  268        if (switchWidth > 0 && switchHeight > 0) {
 
  276            if (compactRepresentationItem && fullRepresentationItem) {
 
  277                QObject *compactLayout = searchLayoutAttached(compactRepresentationItem);
 
  278                QObject *fullLayout = searchLayoutAttached(fullRepresentationItem);
 
  279                if (compactLayout && fullLayout) {
 
  283                    if ((compactPreferred.
width() > fullPreferred.
width() && compactPreferred.
width() > switchWidth) ||
 
  284                        (compactPreferred.
height() > fullPreferred.
height()  && compactPreferred.
height() > switchHeight)) {
 
  289            return q->width() > switchWidth && q->height() > switchHeight;
 
  294            if (preferredRepresentation) {
 
  295                return preferredRepresentation == fullRepresentation;
 
  304void AppletQuickItemPrivate::preloadForExpansion()
 
  311    if (!createFullRepresentationItem()) {
 
  316    if (!appletShouldBeExpanded() && !applet->isContainment() && (!preferredRepresentation || preferredRepresentation != fullRepresentation)) {
 
  317        createCompactRepresentationExpanderItem();
 
  320    if (!appletShouldBeExpanded() && compactRepresentationExpanderItem) {
 
  322    } 
else if (fullRepresentationItem) {
 
  327    if (fullRepresentationItem && fullRepresentationItem->window()) {
 
  328        fullRepresentationItem->window()->create();
 
  343void AppletQuickItemPrivate::compactRepresentationCheck()
 
  350    if (q->width() <= 0 || q->height() <= 0) {
 
  355    if (compactRepresentationCheckGuard) {
 
  359    bool full = appletShouldBeExpanded();
 
  361    if ((full && fullRepresentationItem && fullRepresentationItem == currentRepresentationItem)
 
  362        || (!full && compactRepresentationItem && compactRepresentationItem == currentRepresentationItem)) {
 
  366    compactRepresentationCheckGuard = 
true;
 
  370        QQuickItem *item = createFullRepresentationItem();
 
  374            if (compactRepresentationExpanderItem) {
 
  375                compactRepresentationExpanderItem->setProperty(
"fullRepresentation", 
QVariant());
 
  376                compactRepresentationExpanderItem->setProperty(
"compactRepresentation", 
QVariant());
 
  377                compactRepresentationExpanderItem->setVisible(
false);
 
  380            const bool fullRepresentationWasVisible = fullRepresentationItem->parentItem() == q;
 
  386                anchorsFillParent(item, q);
 
  389            if (compactRepresentationItem) {
 
  390                compactRepresentationItem->setVisible(
false);
 
  393            currentRepresentationItem = item;
 
  394            connectLayoutAttached(item);
 
  396            if (!expanded && !fullRepresentationWasVisible) {
 
  398                Q_EMIT q->expandedChanged(
true);
 
  404        QQuickItem *compactItem = createCompactRepresentationItem();
 
  405        QQuickItem *compactExpanderItem = createCompactRepresentationExpanderItem();
 
  407        if (compactItem && compactExpanderItem) {
 
  412            anchorsFillParent(compactExpanderItem, q);
 
  416            const bool fullRepresentationWasVisible = fullRepresentationItem && fullRepresentationItem->parentItem() == q;
 
  417            if (fullRepresentationItem && fullRepresentationWasVisible) {
 
  418                fullRepresentationItem->setProperty(
"parent", 
QVariant());
 
  425            currentRepresentationItem = compactItem;
 
  426            connectLayoutAttached(compactItem);
 
  430            if (expanded && fullRepresentationWasVisible) {
 
  432                Q_EMIT q->expandedChanged(
false);
 
  437    compactRepresentationCheckGuard = 
false;
 
  440void AppletQuickItemPrivate::minimumWidthChanged()
 
  442    propagateSizeHint(
"minimumWidth");
 
  445void AppletQuickItemPrivate::minimumHeightChanged()
 
  447    propagateSizeHint(
"minimumHeight");
 
  450void AppletQuickItemPrivate::preferredWidthChanged()
 
  452    propagateSizeHint(
"preferredWidth");
 
  455void AppletQuickItemPrivate::preferredHeightChanged()
 
  457    propagateSizeHint(
"preferredHeight");
 
  460void AppletQuickItemPrivate::maximumWidthChanged()
 
  462    propagateSizeHint(
"maximumWidth");
 
  465void AppletQuickItemPrivate::maximumHeightChanged()
 
  467    propagateSizeHint(
"maximumHeight");
 
  470void AppletQuickItemPrivate::fillWidthChanged()
 
  472    propagateSizeHint(
"fillWidth");
 
  475void AppletQuickItemPrivate::fillHeightChanged()
 
  477    propagateSizeHint(
"fillHeight");
 
  480AppletQuickItem::AppletQuickItem(
QQuickItem *parent)
 
  482    , d(new AppletQuickItemPrivate(this))
 
  486AppletQuickItem::~AppletQuickItem()
 
  488    AppletQuickItemPrivate::s_itemsForApplet.
remove(d->applet);
 
  490    if (d->s_preloadPolicy >= AppletQuickItemPrivate::Adaptive) {
 
  491        d->applet->config().writeEntry(QStringLiteral(
"PreloadWeight"), qMax(0, d->preloadWeight() - AppletQuickItemPrivate::PreloadWeightDecrement));
 
  495    delete d->compactRepresentationItem;
 
  496    delete d->fullRepresentationItem;
 
  497    delete d->compactRepresentationExpanderItem;
 
  503    return AppletQuickItemPrivate::s_itemsForApplet.
contains(applet);
 
  506AppletQuickItem *AppletQuickItem::itemForApplet(
Plasma::Applet *applet)
 
  513    if (AppletQuickItemPrivate::s_itemsForApplet.isEmpty()) {
 
  514        const char *uri = 
"org.kde.plasma.plasmoid";
 
  515        qmlRegisterExtendedType<Plasma::Applet, PlasmoidAttached>(uri, 2, 0, 
"Plasmoid");
 
  516        qmlRegisterExtendedType<Plasma::Containment, ContainmentAttached>(uri, 2, 0, 
"Containment");
 
  518        qmlRegisterType<PlasmoidItem>(uri, 2, 0, 
"PlasmoidItem");
 
  519        qmlRegisterType<ContainmentItem>(uri, 2, 0, 
"ContainmentItem");
 
  520        qmlRegisterType<WallpaperItem>(uri, 2, 0, 
"WallpaperItem");
 
  521        qmlRegisterAnonymousType<Plasma::Corona>(
"org.kde.plasma.plasmoid", 1);
 
  523    auto it = AppletQuickItemPrivate::s_itemsForApplet.
constFind(applet);
 
  524    if (it != AppletQuickItemPrivate::s_itemsForApplet.constEnd()) {
 
  529    if (qApp->closingDown() || applet->
destroyed()) {
 
  535    qmlObject->engine()->setProperty(
"_kirigamiTheme", QStringLiteral(
"KirigamiPlasmaStyle"));
 
  536    qmlObject->setInitializationDelayed(
true);
 
  539    AppletQuickItem *item = 
nullptr;
 
  540    qmlObject->setSource(applet->mainScript());
 
  542    Q_ASSERT(qmlObject->mainComponent());
 
  545        item = qobject_cast<ContainmentItem *>(qmlObject->rootObject());
 
  546        if (!item && !qmlObject->mainComponent()->isError()) {
 
  550        item = qobject_cast<PlasmoidItem *>(qmlObject->rootObject());
 
  551        if (!item && !qmlObject->mainComponent()->isError()) {
 
  556    if (!item || qmlObject->mainComponent()->isError() || applet->
failedToLaunch()) {
 
  560        errorData[QStringLiteral(
"appletName")] = 
i18n(
"Unknown Applet");
 
  561        errorData[QStringLiteral(
"isDebugMode")] = qEnvironmentVariableIntValue(
"PLASMA_ENABLE_QML_DEBUG") != 0;
 
  563        if (applet->sourceValid()) {
 
  570            bool versionMismatch = 
false;
 
  571            const int plasma_version_major = 6; 
 
  574                    "This Widget was written for an unknown older version of Plasma and is not compatible with Plasma %1. Please contact the widget's author for " 
  575                    "an updated version.",
 
  576                    plasma_version_major);
 
  577                compactReason = 
i18n(
"%1 is not compatible with Plasma %2", applet->
pluginMetaData().
name(), plasma_version_major);
 
  578                versionMismatch = 
true;
 
  579            } 
else if (
version.majorVersion() < plasma_version_major) {
 
  581                    i18n(
"This Widget was written for Plasma %1 and is not compatible with Plasma %2. Please contact the widget's author for an updated version.",
 
  583                        plasma_version_major);
 
  584                compactReason = 
i18n(
"%1 is not compatible with Plasma %2", applet->
pluginMetaData().
name(), plasma_version_major);
 
  585                versionMismatch = 
true;
 
  586            } 
else if (
version.majorVersion() > plasma_version_major || 
version.minorVersion() > PLASMA_VERSION_MINOR) {
 
  587                reason = 
i18n(
"This Widget was written for Plasma %1 and is not compatible with Plasma %2. Please update Plasma in order to use the widget.",
 
  589                            plasma_version_major);
 
  590                compactReason = 
i18n(
"%1 is not compatible with Plasma %2", applet->
pluginMetaData().
name(), plasma_version_major);
 
  591                versionMismatch = 
true;
 
  594                compactReason = reason;
 
  599            if (compactReason != 
QString()) {
 
  600                errorData[QStringLiteral(
"compactError")] = compactReason;
 
  603            if (!versionMismatch) {
 
  604                const auto errors = qmlObject->mainComponent()->errors();
 
  613            reason += 
i18n(
"Error loading QML file: %1 %2", qmlObject->mainComponent()->url().toString(), reason);
 
  616            reason = 
i18n(
"Error loading Applet: package %1 does not exist.", pluginId);
 
  618            compactReason = 
i18n(
"Sorry! There was an error loading %1.", pluginId);
 
  619            errorData[QStringLiteral(
"compactError")] = compactReason;
 
  623                                   << errorData[QStringLiteral(
"errors")].toVariant().toStringList();
 
  629        if (qmlObject->mainComponent()->isError()) {
 
  633        item = qobject_cast<PlasmoidItem *>(qmlObject->rootObject());
 
  637            item->setProperty(
"errorInformation", errorData);
 
  640            qCWarning(LOG_PLASMAQUICK) << 
"Applet Error message is not of type PlasmoidItem" 
  646    AppletQuickItemPrivate::s_itemsForApplet[applet] = item;
 
  647    qmlObject->setInitializationDelayed(
false);
 
  648    qmlObject->completeInitialization();
 
  657    item->d->applet = applet;
 
  658    item->d->qmlObject = qmlObject;
 
  660    if (!qEnvironmentVariableIntValue(
"PLASMA_NO_CONTEXTPROPERTIES")) {
 
  661        qmlObject->rootContext()->setContextProperty(QStringLiteral(
"plasmoid"), applet);
 
  668        if (qmlObject->parent() == applet) {
 
  671            AppletQuickItemPrivate::s_itemsForApplet.
remove(applet);
 
  684void AppletQuickItem::init()
 
  690    if (d->initComplete) {
 
  694    if (d->applet->containment()) {
 
  695        if (d->applet->containment()->corona()) {
 
  696            d->coronaPackage = d->applet->containment()->corona()->kPackage();
 
  701    QQmlEngine *engine = d->qmlObject->engine().get();
 
  706    if (!d->compactRepresentation && d->fullRepresentation) {
 
  708        d->compactRepresentation->loadUrl(d->coronaPackage.fileUrl(
"defaultcompactrepresentation"));
 
  709        Q_EMIT compactRepresentationChanged(d->compactRepresentation);
 
  713    if (!d->compactRepresentationExpander && d->fullRepresentation) {
 
  714        d->compactRepresentationExpander = 
new QQmlComponent(engine, 
this);
 
  715        QUrl compactExpanderUrl = d->applet->containment()->compactApplet();
 
  716        if (compactExpanderUrl.
isEmpty()) {
 
  717            compactExpanderUrl = d->coronaPackage.fileUrl(
"compactapplet");
 
  720        d->compactRepresentationExpander->loadUrl(compactExpanderUrl);
 
  723    d->initComplete = 
true;
 
  724    d->compactRepresentationCheck();
 
  729    if (d->applet->isContainment() || d->expanded || d->preferredRepresentation == d->fullRepresentation) {
 
  733    if (!d->applet->isContainment() && d->applet->containment()) {
 
  735            if (uiReady && d->s_preloadPolicy >= AppletQuickItemPrivate::Adaptive) {
 
  736                const int preloadWeight = d->preloadWeight();
 
  737                qCDebug(LOG_PLASMAQUICK) << 
"New Applet " << d->applet->title() << 
"with a weight of" << preloadWeight;
 
  740                if (d->s_preloadPolicy >= AppletQuickItemPrivate::Aggressive || preloadWeight >= AppletQuickItemPrivate::DelayedPreloadWeight) {
 
  745                    const int min = (100 - preloadWeight) * 20;
 
  746                    const int max = (100 - preloadWeight) * 100;
 
  747                    const int delay = QRandomGenerator::global()->bounded((max + 1) - min) + min;
 
  748                    QTimer::singleShot(delay, this, [this, delay]() {
 
  749                        qCDebug(LOG_PLASMAQUICK) << 
"Delayed preload of " << d->applet->title() << 
"after" << (qreal)delay / 1000 << 
"seconds";
 
  750                        d->preloadForExpansion();
 
  758void AppletQuickItem::classBegin()
 
  763        qCWarning(LOG_PLASMAQUICK) << 
"Detected a PlasmoidItem which is not the root QML item: this is not supported.";
 
  766    d->applet = ac->applet();
 
  767    d->qmlObject = ac->sharedQmlEngine();
 
  770void AppletQuickItem::componentComplete()
 
  776int AppletQuickItem::switchWidth()
 const 
  778    return d->switchWidth;
 
  781void AppletQuickItem::setSwitchWidth(
int width)
 
  783    if (d->switchWidth == width) {
 
  787    d->switchWidth = width;
 
  788    d->compactRepresentationCheck();
 
  789    Q_EMIT switchWidthChanged(width);
 
  792int AppletQuickItem::switchHeight()
 const 
  794    return d->switchHeight;
 
  797void AppletQuickItem::setSwitchHeight(
int height)
 
  799    if (d->switchHeight == height) {
 
  803    d->switchHeight = height;
 
  804    d->compactRepresentationCheck();
 
  805    Q_EMIT switchHeightChanged(height);
 
  810    return d->compactRepresentation;
 
  813void AppletQuickItem::setCompactRepresentation(
QQmlComponent *component)
 
  815    if (d->compactRepresentation == component) {
 
  819    d->compactRepresentation = component;
 
  820    Q_EMIT compactRepresentationChanged(component);
 
  825    return d->fullRepresentation;
 
  828void AppletQuickItem::setFullRepresentation(
QQmlComponent *component)
 
  830    if (d->fullRepresentation == component) {
 
  834    d->fullRepresentation = component;
 
  835    Q_EMIT fullRepresentationChanged(component);
 
  840    return d->preferredRepresentation;
 
  843void AppletQuickItem::setPreferredRepresentation(
QQmlComponent *component)
 
  845    if (d->preferredRepresentation == component) {
 
  849    d->preferredRepresentation = component;
 
  850    Q_EMIT preferredRepresentationChanged(component);
 
  851    d->compactRepresentationCheck();
 
  854bool AppletQuickItem::isExpanded()
 const 
  856    return d->applet->isContainment() || !d->fullRepresentation || d->expanded;
 
  859void AppletQuickItem::setExpanded(
bool expanded)
 
  861    if (d->expanded == expanded) {
 
  866        d->preloadForExpansion();
 
  868        if (d->s_preloadPolicy >= AppletQuickItemPrivate::Adaptive && !d->applet->isContainment()) {
 
  869            const int newWeight = qMin(d->preloadWeight() + AppletQuickItemPrivate::PreloadWeightIncrement, 100);
 
  870            d->applet->config().writeEntry(QStringLiteral(
"PreloadWeight"), newWeight);
 
  871            qCDebug(LOG_PLASMAQUICK) << 
"Increasing score for" << d->applet->title() << 
"to" << newWeight;
 
  875    d->expanded = expanded;
 
  877    Q_EMIT expandedChanged(expanded);
 
  880bool AppletQuickItem::isActivationTogglesExpanded()
 const 
  882    return d->activationTogglesExpanded;
 
  885void AppletQuickItem::setActivationTogglesExpanded(
bool activationTogglesExpanded)
 
  887    if (d->activationTogglesExpanded == activationTogglesExpanded) {
 
  890    d->activationTogglesExpanded = activationTogglesExpanded;
 
  891    Q_EMIT activationTogglesExpandedChanged(activationTogglesExpanded);
 
  894bool AppletQuickItem::hideOnWindowDeactivate()
 const 
  896    return d->hideOnWindowDeactivate;
 
  899void AppletQuickItem::setHideOnWindowDeactivate(
bool hide)
 
  901    if (d->hideOnWindowDeactivate == hide) {
 
  904    d->hideOnWindowDeactivate = hide;
 
  905    Q_EMIT hideOnWindowDeactivateChanged(hide);
 
  908bool AppletQuickItem::preloadFullRepresentation()
 const 
  910    return d->preloadFullRepresentation;
 
  913void AppletQuickItem::setPreloadFullRepresentation(
bool preload)
 
  915    if (d->preloadFullRepresentation == preload) {
 
  919    d->preloadFullRepresentation = preload;
 
  920    d->createFullRepresentationItem();
 
  922    Q_EMIT preloadFullRepresentationChanged(preload);
 
  925bool AppletQuickItem::expandedOnDragHover()
 const 
  927    return d->expandedOnDragHover;
 
  930void AppletQuickItem::setExpandedOnDragHover(
bool expandedOnDragHover)
 
  932    if (expandedOnDragHover == d->expandedOnDragHover) {
 
  936    d->expandedOnDragHover = expandedOnDragHover;
 
  937    Q_EMIT expandedOnDragHoverChanged(expandedOnDragHover);
 
  940QString AppletQuickItem::badgeText()
 const 
  945void AppletQuickItem::setBadgeText(
const QString &text)
 
  947    if (text == d->badgeText) {
 
  952    Q_EMIT badgeTextChanged(text);
 
  962QQuickItem *AppletQuickItem::compactRepresentationItem()
 
  964    return d->compactRepresentationItem;
 
  967QQuickItem *AppletQuickItem::fullRepresentationItem()
 
  969    return d->fullRepresentationItem;
 
  972void AppletQuickItem::childEvent(
QChildEvent *event)
 
  975    if (
event->added() && !d->ownLayout && d->currentRepresentationItem) {
 
  979                d->connectLayoutAttached(d->currentRepresentationItem);
 
  987void AppletQuickItem::geometryChange(
const QRectF &newGeometry, 
const QRectF &oldGeometry)
 
  990    d->compactRepresentationCheck();
 
  994#include "moc_appletquickitem.cpp" 
QUrl fileUrl(const QByteArray &key, const QString &filename=QString()) const
 
An object that instantiates an entire QML context, with its own declarative engine.
 
void updateConstraints(Constraints constraints=AllConstraints)
Called when any of the geometry constraints have been updated.
 
void setHasConfigurationInterface(bool hasInterface)
Sets whether or not this applet provides a user interface for configuring the applet.
 
bool failedToLaunch() const
If for some reason, the applet fails to get up on its feet (the library couldn't be loaded,...
 
@ UiReadyConstraint
The ui has been completely loaded.
 
bool isContainment
True if this applet is a Containment and is acting as one, such as a desktop or a panel.
 
QString translationDomain() const
The translation domain for this applet.
 
void appletDeleted(Plasma::Applet *applet)
Emitted when the applet is deleted.
 
void setLaunchErrorMessage(const QString &reason=QString())
Call this method when the applet fails to launch properly.
 
Plasma::Containment * containment
The Containment managing this applet.
 
void flushPendingConstraintsEvents()
Sends all pending constraints updates to the applet.
 
KPluginMetaData pluginMetaData() const
 
QString launchErrorMessage() const
If for some reason, the applet fails to get up on its feet (the library couldn't be loaded,...
 
The base class for plugins that provide backgrounds and applet grouping containers.
 
void uiReadyChanged(bool uiReady)
Emitted when the ui has been fully loaded and is fully working.
 
Plasma::Corona * corona
The corona for this contaiment.
 
@ CustomEmbedded
A customized containment embedded in another applet.
 
Plasma::Containment::Type containmentType
Type of this containment.
 
@ Vertical
The applet is constrained horizontally, but can expand vertically.
 
@ Horizontal
The applet is constrained vertically, but can expand horizontally.
 
QString i18n(const char *text, const TYPE &arg...)
 
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
 
const char * versionString()
 
KDB_EXPORT KDbVersionInfo version()
 
void errorList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &title=QString(), Options options=Notify)
 
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
 
The EdgeEventForwarder class This class forwards edge events to be replayed within the given margin T...
 
const char * constData() const const
 
qint64 currentMSecsSinceEpoch()
 
const_iterator constFind(const Key &key) const const
 
bool contains(const Key &key) const const
 
bool remove(const Key &key)
 
QJsonArray fromStringList(const QStringList &list)
 
T value(qsizetype i) const const
 
QLoggingCategory * defaultCategory()
 
virtual void childEvent(QChildEvent *event)
 
const QObjectList & children() const const
 
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect(const QMetaObject::Connection &connection)
 
QVariant property(const char *name) const const
 
bool setProperty(const char *name, QVariant &&value)
 
void setBaseUrl(const QUrl &baseUrl)
 
QQmlContext * contextForObject(const QObject *object)
 
QQmlContext * rootContext() const const
 
bool write(QObject *object, const QString &name, const QVariant &value)
 
virtual void classBegin() override
 
virtual void componentComplete() override
 
virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
 
QQuickItem * parentItem() const const
 
qreal height() const const
 
qreal width() const const
 
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
 
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
 
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
 
bool isEmpty() const const
 
QString toString(FormattingOptions options) const const
 
QVariant fromValue(T &&value)
 
qreal toReal(bool *ok) const const
 
QVersionNumber fromString(QAnyStringView string, qsizetype *suffixIndex)