add press/release signals

svn path=/trunk/KDE/kdelibs/; revision=1022977
This commit is contained in:
Aaron J. Seigo 2009-09-13 16:50:00 +00:00
parent 5cc2ddf8ad
commit 0ab4b19c25
2 changed files with 25 additions and 3 deletions

View File

@ -71,10 +71,9 @@ public:
if (mime->is("image/svg+xml") || mime->is("image/svg+xml-compressed")) { if (mime->is("image/svg+xml") || mime->is("image/svg+xml-compressed")) {
svg = new Svg(); svg = new Svg();
QPainter p(&pm);
svg->setImagePath(absImagePath); svg->setImagePath(absImagePath);
QPainter p(&pm);
if (!svgElement.isNull() && svg->hasElement(svgElement)) { if (!svgElement.isNull() && svg->hasElement(svgElement)) {
QSizeF elementSize = svg->elementSize(svgElement); QSizeF elementSize = svg->elementSize(svgElement);
float scale = pm.width() / qMax(elementSize.width(), elementSize.height()); float scale = pm.width() / qMax(elementSize.width(), elementSize.height());
@ -163,6 +162,8 @@ PushButton::PushButton(QGraphicsWidget *parent)
d(new PushButtonPrivate(this)) d(new PushButtonPrivate(this))
{ {
KPushButton *native = new KPushButton; 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(clicked()), this, SIGNAL(clicked()));
connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool))); connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
setWidget(native); setWidget(native);

View File

@ -114,7 +114,7 @@ public:
QAction *action() const; QAction *action() const;
/** /**
* sets the icon for this toolbutton * sets the icon for this push button
* *
* @arg icon the icon we want to use * @arg icon the icon we want to use
* *
@ -157,7 +157,28 @@ public:
KPushButton *nativeWidget() const; KPushButton *nativeWidget() const;
Q_SIGNALS: 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(); void clicked();
/**
* Emitted when the button changes state from up to down
*/
void toggled(bool); void toggled(bool);
protected: protected: