backport size hints fix
svn path=/branches/KDE/4.4/kdelibs/; revision=1071056
This commit is contained in:
parent
292ad2ee4a
commit
66e7fa884b
@ -196,6 +196,7 @@ PushButton::~PushButton()
|
||||
void PushButton::setText(const QString &text)
|
||||
{
|
||||
static_cast<KPushButton*>(widget())->setText(text);
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
QString PushButton::text() const
|
||||
@ -509,6 +510,24 @@ void PushButton::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
QGraphicsProxyWidget::hoverLeaveEvent(event);
|
||||
}
|
||||
|
||||
QSizeF PushButton::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
|
||||
{
|
||||
QSizeF hint = QGraphicsProxyWidget::sizeHint(which, constraint);
|
||||
|
||||
if (hint.isEmpty()) {
|
||||
return hint;
|
||||
}
|
||||
|
||||
//replace the native margin with the Svg one
|
||||
QStyleOption option;
|
||||
option.initFrom(nativeWidget());
|
||||
int nativeMargin = nativeWidget()->style()->pixelMetric(QStyle::PM_ButtonMargin, &option, nativeWidget());
|
||||
qreal left, top, right, bottom;
|
||||
d->background->getMargins(left, top, right, bottom);
|
||||
hint = hint - QSize(nativeMargin, nativeMargin) + QSize(left+right, top+bottom);
|
||||
return hint;
|
||||
}
|
||||
|
||||
} // namespace Plasma
|
||||
|
||||
#include <pushbutton.moc>
|
||||
|
@ -217,6 +217,7 @@ protected:
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
void changeEvent(QEvent *event);
|
||||
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const;
|
||||
|
||||
private:
|
||||
Q_PRIVATE_SLOT(d, void syncBorders())
|
||||
|
Loading…
Reference in New Issue
Block a user