ensure the frame is resized

This commit is contained in:
Marco Martin 2011-08-12 16:03:40 +02:00
parent 33e9192346
commit d9b8860784

View File

@ -111,6 +111,25 @@ public:
} }
} }
void syncFrame()
{
if (background) {
//resize all panels
background->setElementPrefix("pressed");
background->resizeFrame(q->size());
syncActiveRect();
background->setElementPrefix("normal");
background->resizeFrame(q->size());
hoverAnimation->setProperty("startPixmap", background->framePixmap());
background->setElementPrefix("active");
background->resizeFrame(activeRect.size());
hoverAnimation->setProperty("targetPixmap", background->framePixmap());
}
}
void syncActiveRect(); void syncActiveRect();
void syncBorders(); void syncBorders();
@ -193,6 +212,7 @@ PushButton::PushButton(QGraphicsWidget *parent)
connect(d->background, SIGNAL(repaintNeeded()), SLOT(syncBorders())); connect(d->background, SIGNAL(repaintNeeded()), SLOT(syncBorders()));
d->initTheming(); d->initTheming();
d->syncFrame();
} }
PushButton::~PushButton() PushButton::~PushButton()
@ -325,23 +345,9 @@ void PushButton::resizeEvent(QGraphicsSceneResizeEvent *event)
{ {
d->setPixmap(); d->setPixmap();
if (d->background) { d->syncFrame();
//resize all panels
d->background->setElementPrefix("pressed");
d->background->resizeFrame(size());
d->syncActiveRect(); QGraphicsProxyWidget::resizeEvent(event);
d->background->setElementPrefix("normal");
d->background->resizeFrame(size());
d->hoverAnimation->setProperty("startPixmap", d->background->framePixmap());
d->background->setElementPrefix("active");
d->background->resizeFrame(d->activeRect.size());
d->hoverAnimation->setProperty("targetPixmap", d->background->framePixmap());
}
QGraphicsProxyWidget::resizeEvent(event);
} }
void PushButton::paint(QPainter *painter, void PushButton::paint(QPainter *painter,