From f2af7e8087348b5abc87d76fb53b69c5d2a53d8d Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Sun, 13 Sep 2009 17:37:36 +0000 Subject: [PATCH] kicon and qicon are treated differnetly internally by KPushButton, so we unforunately we need to provide an overload here svn path=/trunk/KDE/kdelibs/; revision=1022998 --- widgets/pushbutton.cpp | 7 ++++++- widgets/pushbutton.h | 14 +++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) 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 *