Fix the squashed line edits.

svn path=/trunk/KDE/kdelibs/; revision=1056867
This commit is contained in:
Fredrik Höglund 2009-12-01 00:58:28 +00:00
parent 1deb1a958a
commit 82759f1094
2 changed files with 37 additions and 0 deletions

View File

@ -335,6 +335,40 @@ int Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWi
}
}
QRect Style::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
{
switch (element) {
case SE_LineEditContents: {
d->createTextBox();
d->textBox->setElementPrefix("base");
qreal left, top, right, bottom;
d->textBox->getMargins(left, top, right, bottom);
return option->rect.adjusted(left + 2, top + 2, -(right + 2), -(bottom + 2));
}
default:
return qApp->style()->subElementRect(element, option, widget);
}
}
QSize Style::sizeFromContents(ContentsType type, const QStyleOption *option,
const QSize &contentsSize, const QWidget *widget) const
{
switch (type) {
case CT_LineEdit: {
d->createTextBox();
d->textBox->setElementPrefix("base");
qreal left, top, right, bottom;
d->textBox->getMargins(left, top, right, bottom);
return contentsSize + QSize(left + right + 4, top + bottom + 4);
}
default:
return qApp->style()->sizeFromContents(type, option, contentsSize, widget);
}
}
}
#include "style_p.moc"

View File

@ -56,6 +56,9 @@ protected:
QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option,
SubControl subControl, const QWidget *widget) const;
QRect subElementRect(SubElement element, const QStyleOption * option, const QWidget *widget = 0) const;
QSize sizeFromContents(ContentsType, const QStyleOption *option, const QSize &contentsSize,
const QWidget *widget = 0) const;
private:
StylePrivate *d;
};