properly forward containmentDisplayHintsChanged

make possible to write containmentDisplayHintsChanged from
ContainmentInterface QML
when containmentDisplayHintsChanged, the containment forwards to
all its applets
This commit is contained in:
Marco Martin 2020-12-03 13:53:40 +00:00
parent 0e973e852f
commit da6b8c10c1
3 changed files with 12 additions and 0 deletions

View File

@ -407,6 +407,7 @@ void Containment::addApplet(Applet *applet)
emit currentContainment->appletRemoved(applet);
disconnect(applet, nullptr, currentContainment, nullptr);
connect(currentContainment, nullptr, applet, nullptr);
KConfigGroup oldConfig = applet->config();
currentContainment->d->applets.removeAll(applet);
applet->setParent(this);
@ -449,6 +450,7 @@ void Containment::addApplet(Applet *applet)
connect(applet, SIGNAL(appletDeleted(Plasma::Applet*)), this, SLOT(appletDeleted(Plasma::Applet*)));
connect(applet, SIGNAL(statusChanged(Plasma::Types::ItemStatus)), this, SLOT(checkStatus(Plasma::Types::ItemStatus)));
connect(applet, &Applet::activated, this, &Applet::activated);
connect(this, &Containment::containmentDisplayHintsChanged, applet, &Applet::containmentDisplayHintsChanged);
if (!currentContainment) {
const bool isNew = applet->d->mainConfigGroup()->entryMap().isEmpty();

View File

@ -872,6 +872,12 @@ QList<QObject *> ContainmentInterface::actions() const
return actionList;
}
void ContainmentInterface::setContainmentDisplayHints(Plasma::Types::ContainmentDisplayHints hints)
{
m_containment->setContainmentDisplayHints(hints);
}
//PROTECTED--------------------
void ContainmentInterface::mouseReleaseEvent(QMouseEvent *event)

View File

@ -75,6 +75,8 @@ class ContainmentInterface : public AppletInterface
*/
Q_PROPERTY(bool editMode READ isEditMode WRITE setEditMode NOTIFY editModeChanged)
Q_PROPERTY(Plasma::Types::ContainmentDisplayHints containmentDisplayHints READ containmentDisplayHints WRITE setContainmentDisplayHints NOTIFY containmentDisplayHintsChanged)
public:
ContainmentInterface(DeclarativeAppletScript *parent, const QVariantList &args = QVariantList());
@ -100,6 +102,8 @@ public:
QList<QObject *> actions() const;
void setContainmentDisplayHints(Plasma::Types::ContainmentDisplayHints hints);
/**
* Process the mime data arrived to a particular coordinate, either with a drag and drop or paste with middle mouse button
*/