From 0ab4b19c259f2f821dc73fa8ee389d8b349b243c Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Sun, 13 Sep 2009 16:50:00 +0000 Subject: [PATCH] add press/release signals svn path=/trunk/KDE/kdelibs/; revision=1022977 --- widgets/pushbutton.cpp | 5 +++-- widgets/pushbutton.h | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/widgets/pushbutton.cpp b/widgets/pushbutton.cpp index 053c68ff6..f90face65 100644 --- a/widgets/pushbutton.cpp +++ b/widgets/pushbutton.cpp @@ -71,10 +71,9 @@ public: if (mime->is("image/svg+xml") || mime->is("image/svg+xml-compressed")) { svg = new Svg(); - QPainter p(&pm); - svg->setImagePath(absImagePath); + QPainter p(&pm); if (!svgElement.isNull() && svg->hasElement(svgElement)) { QSizeF elementSize = svg->elementSize(svgElement); float scale = pm.width() / qMax(elementSize.width(), elementSize.height()); @@ -163,6 +162,8 @@ PushButton::PushButton(QGraphicsWidget *parent) d(new PushButtonPrivate(this)) { KPushButton *native = new KPushButton; + connect(native, SIGNAL(pressed()), this, SIGNAL(pressed())); + connect(native, SIGNAL(released()), this, SIGNAL(released())); connect(native, SIGNAL(clicked()), this, SIGNAL(clicked())); connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool))); setWidget(native); diff --git a/widgets/pushbutton.h b/widgets/pushbutton.h index c29ee6ae4..a3d729f49 100644 --- a/widgets/pushbutton.h +++ b/widgets/pushbutton.h @@ -114,7 +114,7 @@ public: QAction *action() const; /** - * sets the icon for this toolbutton + * sets the icon for this push button * * @arg icon the icon we want to use * @@ -157,7 +157,28 @@ public: KPushButton *nativeWidget() const; Q_SIGNALS: + /** + * Emitted when the button is pressed down; usually the clicked() signal + * will suffice, however. + * @since 4.4 + */ + void pressed(); + + /** + * Emitted when the button is released; usually the clicked() signal + * will suffice, however. + * @since 4.4 + */ + void released(); + + /** + * Emitted when the button is pressed then released, completing a click + */ void clicked(); + + /** + * Emitted when the button changes state from up to down + */ void toggled(bool); protected: