From f5f96c13905ee006ebedafb45febd5fa6eddd18e Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 9 Jul 2014 18:20:32 +0200 Subject: [PATCH] Remove unneeded casts They're all because we're accessing the d-pointer of the parent class (!), we can access it without casting. --- src/plasma/containment.cpp | 7 +++---- src/plasma/private/applet_p.cpp | 9 ++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp index 992d33308..377245ad3 100644 --- a/src/plasma/containment.cpp +++ b/src/plasma/containment.cpp @@ -411,8 +411,8 @@ void Containment::addApplet(Applet *applet) if (!applet->d->uiReady) { d->loadingApplets << applet; - if (static_cast(this)->d->uiReady) { - static_cast(this)->d->uiReady = false; + if (Applet::d->uiReady) { + Applet::d->uiReady = false; emit uiReadyChanged(false); } } @@ -536,8 +536,7 @@ QHash &Containment::containmentActions() bool Containment::isUiReady() const { - const Applet *a = static_cast(this); - return a->d->uiReady && a->d->started; + return Applet::d->uiReady && Applet::d->started; } void Containment::setActivity(const QString &activityId) diff --git a/src/plasma/private/applet_p.cpp b/src/plasma/private/applet_p.cpp index 2f680bf19..3acf40997 100644 --- a/src/plasma/private/applet_p.cpp +++ b/src/plasma/private/applet_p.cpp @@ -315,11 +315,10 @@ void AppletPrivate::setUiReady() c = q->containment(); if (c) { c->d->loadingApplets.remove(q); - Applet *a = qobject_cast(c); - Q_ASSERT(a); - if (c->d->loadingApplets.isEmpty() && a && !a->d->uiReady) { - a->d->uiReady = true; - if (a->d->started) { + + if (c->d->loadingApplets.isEmpty() && !Applet::d->uiReady) { + c->Applet::d->uiReady = true; + if (Applet::d->started) { emit c->uiReadyChanged(true); } }