diff --git a/plasma/applet.cpp b/plasma/applet.cpp index e4cc63aa..35a76792 100644 --- a/plasma/applet.cpp +++ b/plasma/applet.cpp @@ -882,7 +882,7 @@ void Applet::setConfigurationRequired(bool needsConfig, const QString &reason) PushButton *configWidget = new PushButton(d->messageOverlay); if (!qobject_cast(this) && (formFactor() == Plasma::Horizontal || formFactor() == Plasma::Vertical)) { - configWidget->setImage("widgets/configuration-icons", "configure"); + configWidget->setIcon(KIcon("configure")); configWidget->setMaximumSize(24,24); configWidget->setMinimumSize(24,24); } else { diff --git a/plasma/widgets/checkbox.cpp b/plasma/widgets/checkbox.cpp index fd29d252..d94b48df 100644 --- a/plasma/widgets/checkbox.cpp +++ b/plasma/widgets/checkbox.cpp @@ -20,14 +20,8 @@ #include "checkbox.h" #include -#include -#include - -#include #include "private/themedwidgetinterface_p.h" -#include "svg.h" -#include "theme.h" namespace Plasma { @@ -36,49 +30,9 @@ class CheckBoxPrivate : public ThemedWidgetInterface { public: CheckBoxPrivate(CheckBox *c) - : ThemedWidgetInterface(c), - svg(nullptr) + : ThemedWidgetInterface(c) { } - - ~CheckBoxPrivate() - { - delete svg; - } - - void setPixmap() - { - if (imagePath.isEmpty()) { - delete svg; - svg = nullptr; - return; - } - - KMimeType::Ptr mime = KMimeType::findByUrl(KUrl(absImagePath)); - QPixmap pm(q->size().toSize()); - - if (mime->is("image/svg+xml") || mime->is("image/svg+xml-compressed")) { - if (!svg || svg->imagePath() != imagePath) { - delete svg; - svg = new Svg(); - svg->setImagePath(imagePath); - QObject::connect(svg, SIGNAL(repaintNeeded()), q, SLOT(setPixmap())); - } - - QPainter p(&pm); - svg->paint(&p, pm.rect()); - } else { - delete svg; - svg = nullptr; - pm = QPixmap(absImagePath); - } - - static_cast(q->widget())->setIcon(QIcon(pm)); - } - - QString imagePath; - QString absImagePath; - Svg *svg; }; CheckBox::CheckBox(QGraphicsWidget *parent) @@ -101,37 +55,12 @@ CheckBox::~CheckBox() void CheckBox::setText(const QString &text) { - static_cast(widget())->setText(text); + nativeWidget()->setText(text); } QString CheckBox::text() const { - return static_cast(widget())->text(); -} - -void CheckBox::setImage(const QString &path) -{ - if (d->imagePath == path) { - return; - } - - delete d->svg; - d->svg = nullptr; - d->imagePath = path; - - const bool absolutePath = (!path.isEmpty() && path[0] == '/'); - if (absolutePath) { - d->absImagePath = path; - } else { - d->absImagePath = Theme::defaultTheme()->imagePath(path); - } - - d->setPixmap(); -} - -QString CheckBox::image() const -{ - return d->imagePath; + return nativeWidget()->text(); } QCheckBox *CheckBox::nativeWidget() const @@ -139,20 +68,14 @@ QCheckBox *CheckBox::nativeWidget() const return static_cast(widget()); } -void CheckBox::resizeEvent(QGraphicsSceneResizeEvent *event) -{ - d->setPixmap(); - QGraphicsProxyWidget::resizeEvent(event); -} - void CheckBox::setChecked(bool checked) { - static_cast(widget())->setChecked(checked); + nativeWidget()->setChecked(checked); } bool CheckBox::isChecked() const { - return static_cast(widget())->isChecked(); + return nativeWidget()->isChecked(); } void CheckBox::changeEvent(QEvent *event) diff --git a/plasma/widgets/checkbox.h b/plasma/widgets/checkbox.h index 8e2452ac..2e4ec6ab 100644 --- a/plasma/widgets/checkbox.h +++ b/plasma/widgets/checkbox.h @@ -40,7 +40,6 @@ class PLASMA_EXPORT CheckBox : public QGraphicsProxyWidget { Q_OBJECT Q_PROPERTY(QString text READ text WRITE setText) - Q_PROPERTY(QString image READ image WRITE setImage) Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled) public: @@ -59,18 +58,6 @@ public: */ QString text() const; - /** - * Sets the path to an image to display. - * - * @param path the path to the image; if a relative path, then a themed image will be loaded. - */ - void setImage(const QString &path); - - /** - * @return the image path being displayed currently, or an empty string if none. - */ - QString image() const; - /** * @return the native widget wrapped by this CheckBox */ @@ -92,12 +79,10 @@ Q_SIGNALS: void toggled(bool); protected: - void resizeEvent(QGraphicsSceneResizeEvent *event); void changeEvent(QEvent *event); private: Q_PRIVATE_SLOT(d, void setPalette()) - Q_PRIVATE_SLOT(d, void setPixmap()) CheckBoxPrivate * const d; }; diff --git a/plasma/widgets/label.cpp b/plasma/widgets/label.cpp index fdc6b095..f626b32e 100644 --- a/plasma/widgets/label.cpp +++ b/plasma/widgets/label.cpp @@ -20,20 +20,11 @@ #include "label.h" #include -#include -#include +#include #include -#include -#include -#include - -#include -#include -#include +#include #include "private/themedwidgetinterface_p.h" -#include "svg.h" -#include "theme.h" namespace Plasma { @@ -42,49 +33,9 @@ class LabelPrivate : public ThemedWidgetInterface