button release event for PushButon

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=642014
This commit is contained in:
Siraj Razick 2007-03-13 02:51:40 +00:00
parent e41598b02a
commit 19f05aab0c
2 changed files with 13 additions and 0 deletions

View File

@ -92,8 +92,11 @@ void PushButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
QStyleOptionButton options;
options.initFrom(widget);
options.state = option->state;
options.state |= isDown() ? QStyle::State_Sunken : QStyle::State_Raised;
options.rect = boundingRect().toRect();
options.text = text();
if (d->hasIcon){
options.icon= d->icon;
options.iconSize = d->iconSize;
@ -197,9 +200,18 @@ void PushButton::mousePressEvent ( QGraphicsSceneMouseEvent * event )
event->accept();
d->state = PushButton::PRESSED;
update();
// emit clicked();
}
void PushButton::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event )
{
event->accept();
d->state = PushButton::RELEASED;
update();
emit clicked();
}
QSize PushButton::sizeHint() const
{
return QSize(d->width,d->height);

View File

@ -71,6 +71,7 @@ class KDE_EXPORT PushButton : public DataVisualization,public QGraphicsItem, pub
protected:
bool isDown();
void mousePressEvent ( QGraphicsSceneMouseEvent * event );
void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
private:
class Private ;
Private * const d;