button release event for PushButon
svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=642014
This commit is contained in:
parent
e41598b02a
commit
19f05aab0c
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user