mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-25 11:22:58 +00:00
optimize QStyle::itemTextRect()
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
6d04b26155
commit
40b80d3796
1 changed files with 2 additions and 4 deletions
|
@ -448,17 +448,15 @@ void QStyle::polish(QPalette & /* pal */)
|
||||||
QRect QStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rect, int alignment, bool enabled,
|
QRect QStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rect, int alignment, bool enabled,
|
||||||
const QString &text) const
|
const QString &text) const
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
|
||||||
rect.getRect(&x, &y, &w, &h);
|
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
QRect result = metrics.boundingRect(x, y, w, h, alignment, text);
|
QRect result = metrics.boundingRect(rect.x(), rect.y(), rect.width(), rect.height(), alignment, text);
|
||||||
if (!enabled && proxy()->styleHint(SH_EtchDisabledText)) {
|
if (!enabled && proxy()->styleHint(SH_EtchDisabledText)) {
|
||||||
result.setWidth(result.width()+1);
|
result.setWidth(result.width()+1);
|
||||||
result.setHeight(result.height()+1);
|
result.setHeight(result.height()+1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return QRect(x, y, w, h);
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
Loading…
Add table
Reference in a new issue