From 280902bbb57c6a416ea41e15df70b8c1282adf54 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 31 Oct 2014 21:18:52 +0100 Subject: [PATCH] show/hide view when applet asked to be destroyed Change-Id: Id53300532c2322467188dbb44259f25dc6183a1e --- src/plasmaquick/view.cpp | 9 +++++++++ src/plasmaquick/view.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/plasmaquick/view.cpp b/src/plasmaquick/view.cpp index 86e604b34..08fd82e07 100644 --- a/src/plasmaquick/view.cpp +++ b/src/plasmaquick/view.cpp @@ -44,6 +44,7 @@ public: Plasma::Types::FormFactor formFactor() const; Plasma::Types::Location location() const; void showConfigurationInterface(Plasma::Applet *applet); + void updateDestroyed(bool destroyed); View *q; friend class View; @@ -102,6 +103,9 @@ void ViewPrivate::setContainment(Plasma::Containment *cont) q, &View::formFactorChanged); QObject::connect(cont, &Plasma::Containment::configureRequested, q, &View::showConfigurationInterface); + QObject::connect(cont, SIGNAL(destroyedChanged(bool)), + q, SLOT(updateDestroyed(bool))); + q->setVisible(!cont->destroyed() && cont->isUiReady()); } else { return; } @@ -162,6 +166,11 @@ void ViewPrivate::showConfigurationInterface(Plasma::Applet *applet) configView->show(); } +void ViewPrivate::updateDestroyed(bool destroyed) +{ + q->setVisible(!destroyed); +} + View::View(Plasma::Corona *corona, QWindow *parent) : QQuickView(parent), d(new ViewPrivate(corona, this)) diff --git a/src/plasmaquick/view.h b/src/plasmaquick/view.h index 433087090..c85b08cc4 100644 --- a/src/plasmaquick/view.h +++ b/src/plasmaquick/view.h @@ -127,6 +127,7 @@ Q_SIGNALS: private: ViewPrivate *const d; + Q_PRIVATE_SLOT(d, void updateDestroyed(bool)) friend class ViewPrivate; };