pushbutton has a glow also when pressed, toolbutton not.

svn path=/trunk/KDE/kdelibs/; revision=882769
This commit is contained in:
Marco Martin 2008-11-11 12:15:35 +00:00
parent 3cc9af418d
commit bf6ef3f41d
2 changed files with 7 additions and 5 deletions

View File

@ -224,8 +224,6 @@ void PushButton::resizeEvent(QGraphicsSceneResizeEvent *event)
if (d->background) { if (d->background) {
//resize all four panels //resize all four panels
d->background->setElementPrefix("pressed");
d->background->resizeFrame(size());
d->background->setElementPrefix("focus"); d->background->setElementPrefix("focus");
d->background->resizeFrame(size()); d->background->resizeFrame(size());
@ -233,6 +231,8 @@ void PushButton::resizeEvent(QGraphicsSceneResizeEvent *event)
d->background->setElementPrefix("active"); d->background->setElementPrefix("active");
d->background->resizeFrame(d->activeRect.size()); d->background->resizeFrame(d->activeRect.size());
d->background->setElementPrefix("pressed");
d->background->resizeFrame(d->activeRect.size());
d->background->setElementPrefix("normal"); d->background->setElementPrefix("normal");
d->background->resizeFrame(size()); d->background->resizeFrame(size());
@ -254,13 +254,15 @@ void PushButton::paint(QPainter *painter,
//Normal button, pressed or not //Normal button, pressed or not
if (isEnabled()) { if (isEnabled()) {
QPointF topLeft(0,0);
if (nativeWidget()->isDown()) { if (nativeWidget()->isDown()) {
d->background->setElementPrefix("pressed"); d->background->setElementPrefix("pressed");
topLeft = d->activeRect.topLeft();
} else { } else {
d->background->setElementPrefix("normal"); d->background->setElementPrefix("normal");
} }
if (d->animId == -1) { if (d->animId == -1) {
d->background->paintFrame(painter); d->background->paintFrame(painter, topLeft);
} }
//flat or disabled //flat or disabled
} else if (!isEnabled() || nativeWidget()->isFlat()) { } else if (!isEnabled() || nativeWidget()->isFlat()) {

View File

@ -224,7 +224,7 @@ void ToolButton::resizeEvent(QGraphicsSceneResizeEvent *event)
if (d->background) { if (d->background) {
//resize all four panels //resize all four panels
d->background->setElementPrefix("pressed"); d->background->setElementPrefix("toolbutton-pressed");
d->background->resizeFrame(size()); d->background->resizeFrame(size());
d->background->setElementPrefix("focus"); d->background->setElementPrefix("focus");
d->background->resizeFrame(size()); d->background->resizeFrame(size());
@ -262,7 +262,7 @@ void ToolButton::paint(QPainter *painter,
if (d->animId || (buttonOpt.state & QStyle::State_MouseOver) || (buttonOpt.state & QStyle::State_On)) { if (d->animId || (buttonOpt.state & QStyle::State_MouseOver) || (buttonOpt.state & QStyle::State_On)) {
if (button->isDown() || (buttonOpt.state & QStyle::State_On)) { if (button->isDown() || (buttonOpt.state & QStyle::State_On)) {
d->background->setElementPrefix("pressed"); d->background->setElementPrefix("toolbutton-pressed");
} else { } else {
d->background->setElementPrefix("normal"); d->background->setElementPrefix("normal");
} }