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;
|
QStyleOptionButton options;
|
||||||
options.initFrom(widget);
|
options.initFrom(widget);
|
||||||
options.state = option->state;
|
options.state = option->state;
|
||||||
|
options.state |= isDown() ? QStyle::State_Sunken : QStyle::State_Raised;
|
||||||
|
|
||||||
options.rect = boundingRect().toRect();
|
options.rect = boundingRect().toRect();
|
||||||
options.text = text();
|
options.text = text();
|
||||||
|
|
||||||
if (d->hasIcon){
|
if (d->hasIcon){
|
||||||
options.icon= d->icon;
|
options.icon= d->icon;
|
||||||
options.iconSize = d->iconSize;
|
options.iconSize = d->iconSize;
|
||||||
@ -197,9 +200,18 @@ void PushButton::mousePressEvent ( QGraphicsSceneMouseEvent * event )
|
|||||||
event->accept();
|
event->accept();
|
||||||
d->state = PushButton::PRESSED;
|
d->state = PushButton::PRESSED;
|
||||||
update();
|
update();
|
||||||
|
// emit clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PushButton::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event )
|
||||||
|
{
|
||||||
|
event->accept();
|
||||||
|
d->state = PushButton::RELEASED;
|
||||||
|
update();
|
||||||
emit clicked();
|
emit clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QSize PushButton::sizeHint() const
|
QSize PushButton::sizeHint() const
|
||||||
{
|
{
|
||||||
return QSize(d->width,d->height);
|
return QSize(d->width,d->height);
|
||||||
|
@ -71,6 +71,7 @@ class KDE_EXPORT PushButton : public DataVisualization,public QGraphicsItem, pub
|
|||||||
protected:
|
protected:
|
||||||
bool isDown();
|
bool isDown();
|
||||||
void mousePressEvent ( QGraphicsSceneMouseEvent * event );
|
void mousePressEvent ( QGraphicsSceneMouseEvent * event );
|
||||||
|
void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||||
private:
|
private:
|
||||||
class Private ;
|
class Private ;
|
||||||
Private * const d;
|
Private * const d;
|
||||||
|
Loading…
Reference in New Issue
Block a user