Fix the squashed line edits.
svn path=/trunk/KDE/kdelibs/; revision=1056867
This commit is contained in:
parent
1deb1a958a
commit
82759f1094
@ -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"
|
#include "style_p.moc"
|
||||||
|
@ -56,6 +56,9 @@ protected:
|
|||||||
QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option,
|
QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option,
|
||||||
SubControl subControl, const QWidget *widget) const;
|
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:
|
private:
|
||||||
StylePrivate *d;
|
StylePrivate *d;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user