On Tuesday 09 September 2008 21:46:52 Marco Martin wrote: > the patch on popupapplet is derived from the aaron's one > and the clock uses it > thing that i noted: icon() badly clash with Applet::icon() (that's even not > virtual) it's really not the same thing, should have a different name > perhaps?
I've applied the patch and ported the battery to make use of it. Unfortunately, it breaks the battery: its contensRect->size() becomes 0,0. I've attached the patch to the battery that causes this behaviour for me, maybe I'm doing something wrong ... -- sebas http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
diff --git a/workspace/plasma/applets/battery/battery.cpp b/workspace/plasma/applets/battery/battery.cpp index 7229184..ed9b730 100644 --- a/workspace/plasma/applets/battery/battery.cpp +++ b/workspace/plasma/applets/battery/battery.cpp @@ -39,9 +39,11 @@ #include <plasma/svg.h> #include <plasma/theme.h> #include <plasma/animator.h> +#include <plasma/popupapplet.h> + Battery::Battery(QObject *parent, const QVariantList &args) - : Plasma::Applet(parent, args), + : Plasma::PopupApplet(parent, args), m_batteryStyle(0), m_theme(0), m_animId(-1), @@ -63,6 +65,7 @@ Battery::Battery(QObject *parent, const QVariantList &args) setAspectRatioMode(Plasma::ConstrainedSquare ); m_textRect = QRect(); m_theme = new Plasma::Svg(this); + setIcon(QIcon()); } void Battery::init() @@ -175,7 +178,7 @@ void Battery::createConfigurationInterface(KConfigDialog *parent) QWidget *widget = new QWidget(parent); ui.setupUi(widget); parent->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply ); - parent->addPage(widget, parent->windowTitle(), icon()); + parent->addPage(widget, parent->windowTitle(), Applet::icon()); connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); ui.styleGroup->setSelected(m_batteryStyle); @@ -262,6 +265,11 @@ Battery::~Battery() { } +QGraphicsWidget *Battery::graphicsWidget() +{ + return new QGraphicsWidget(this); // TODO +} + void Battery::showLabel(bool show) { if (m_fadeIn == show) { diff --git a/workspace/plasma/applets/battery/battery.h b/workspace/plasma/applets/battery/battery.h index 0077884..64f7c9f 100644 --- a/workspace/plasma/applets/battery/battery.h +++ b/workspace/plasma/applets/battery/battery.h @@ -28,6 +28,7 @@ #include <plasma/applet.h> #include <plasma/animator.h> #include <plasma/dataengine.h> +#include <plasma/popupapplet.h> #include "ui_batteryConfig.h" namespace Plasma @@ -35,7 +36,7 @@ namespace Plasma class Svg; } -class Battery : public Plasma::Applet +class Battery : public Plasma::PopupApplet { Q_OBJECT public: @@ -62,6 +63,7 @@ class Battery : public Plasma::Applet protected: void createConfigurationInterface(KConfigDialog *parent); + QGraphicsWidget *graphicsWidget(); private slots: void animationUpdate(qreal progress);
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel