diff --git a/widgets/pushbutton.cpp b/widgets/pushbutton.cpp index 1c00d85d6..60d2ec9fa 100644 --- a/widgets/pushbutton.cpp +++ b/widgets/pushbutton.cpp @@ -262,11 +262,16 @@ QAction *PushButton::action() const return d->action; } -void PushButton::setIcon(const QIcon &icon) +void PushButton::setIcon(const KIcon &icon) { nativeWidget()->setIcon(icon); } +void PushButton::setIcon(const QIcon &icon) +{ + setIcon(KIcon(icon)); +} + QIcon PushButton::icon() const { return nativeWidget()->icon(); diff --git a/widgets/pushbutton.h b/widgets/pushbutton.h index 80dd0e555..bcc7aeb46 100644 --- a/widgets/pushbutton.h +++ b/widgets/pushbutton.h @@ -22,6 +22,8 @@ #include +#include + class KPushButton; #include @@ -46,6 +48,7 @@ class PLASMA_EXPORT PushButton : public QGraphicsProxyWidget Q_PROPERTY(QString stylesheet READ styleSheet WRITE setStyleSheet) Q_PROPERTY(KPushButton *nativeWidget READ nativeWidget) Q_PROPERTY(QAction *action READ action WRITE setAction) + Q_PROPERTY(QIcon icon READ icon WRITE setIcon) public: explicit PushButton(QGraphicsWidget *parent = 0); @@ -116,12 +119,21 @@ public: /** * sets the icon for this push button * - * @arg icon the icon we want to use + * @arg icon the icon to use * * @since 4.3 */ void setIcon(const QIcon &icon); + /** + * sets the icon for this push button using a KIcon + * + * @arg icon the icon to use + * + * @since 4.4 + */ + void setIcon(const KIcon &icon); + /** * @return the icon of this button *