fix crash; you can't suppose that you get a Widget in ::paint

CCMAIL:tokoe@kde.org

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=718009
This commit is contained in:
Aaron J. Seigo 2007-09-27 22:05:57 +00:00
parent cc626be7e0
commit c982fdde3b

View File

@ -144,12 +144,14 @@ PushButton::~PushButton()
void PushButton::paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *opt, QWidget *widget)
{
QStyleOptionButton option;
if (widget) {
option.initFrom(widget);
}
d->initStyleOption(&option, this, opt);
widget->style()->drawPrimitive(QStyle::PE_PanelButtonCommand, &option, painter, widget);
widget->style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, painter, widget);
widget->style()->drawControl(QStyle::CE_PushButton, &option, painter, widget);
QApplication::style()->drawPrimitive(QStyle::PE_PanelButtonCommand, &option, painter, widget);
QApplication::style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, painter, widget);
QApplication::style()->drawControl(QStyle::CE_PushButton, &option, painter, widget);
}
void PushButton::setText(const QString& text)