[shell/panelshadows] Port away from old style connect

Test Plan: Compiles

Reviewers: #plasma, apol

Reviewed By: apol

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D22842
wilder-5.17
David Edmundson 7 years ago
parent f5a80b8a50
commit 2140776686
  1. 23
      shell/panelshadows.cpp
  2. 3
      shell/panelshadows_p.h

@ -75,7 +75,6 @@ public:
void clearShadowX11(const QWindow *window);
void clearShadowWayland(const QWindow *window);
void updateShadows();
void windowDestroyed(QObject *deletedObject);
void setupData(Plasma::FrameSvg::EnabledBorders enabledBorders);
bool hasShadows() const;
@ -130,7 +129,9 @@ PanelShadows::PanelShadows(QObject *parent, const QString &prefix)
d(new Private(this))
{
setImagePath(prefix);
connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateShadows()));
connect(this, &Plasma::Svg::repaintNeeded, this, [this]() {
d->updateShadows();
});
}
PanelShadows::~PanelShadows()
@ -151,8 +152,12 @@ void PanelShadows::addWindow(const QWindow *window, Plasma::FrameSvg::EnabledBor
d->m_windows[window] = enabledBorders;
d->updateShadow(window, enabledBorders);
connect(window, SIGNAL(destroyed(QObject*)),
this, SLOT(windowDestroyed(QObject*)), Qt::UniqueConnection);
connect(window, &QObject::destroyed, this, [this, window]() {
d->m_windows.remove(window);
if (d->m_windows.isEmpty()) {
d->clearPixmaps();
}
});
}
void PanelShadows::removeWindow(const QWindow *window)
@ -180,16 +185,6 @@ void PanelShadows::setEnabledBorders(const QWindow *window, Plasma::FrameSvg::En
d->updateShadow(window, enabledBorders);
}
void PanelShadows::Private::windowDestroyed(QObject *deletedObject)
{
m_windows.remove(static_cast<QWindow *>(deletedObject));
if (m_windows.isEmpty()) {
clearPixmaps();
}
}
void PanelShadows::Private::updateShadows()
{
const bool hadShadowsBefore = !m_shadowPixmaps.isEmpty();

@ -43,9 +43,6 @@ public:
private:
class Private;
Private * const d;
Q_PRIVATE_SLOT(d, void updateShadows())
Q_PRIVATE_SLOT(d, void windowDestroyed(QObject *deletedObject))
};
#endif

Loading…
Cancel
Save