diff options
author | Adriano Rezende <adriano.rezende@openbossa.org> | 2009-09-08 11:15:49 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-08 11:17:50 (GMT) |
commit | a9572a07f1512fe1266629632e5c4f1613abeb8d (patch) | |
tree | 8ac39bf3b49d8f9ee3879f9ba7edead81b7e55e8 /src/gui/widgets/qlineedit.cpp | |
parent | 9d9b7f53750dce2da88d7d11d312b4b36250b5c5 (diff) | |
download | Qt-a9572a07f1512fe1266629632e5c4f1613abeb8d.zip Qt-a9572a07f1512fe1266629632e5c4f1613abeb8d.tar.gz Qt-a9572a07f1512fe1266629632e5c4f1613abeb8d.tar.bz2 |
Fixed QLineEdit to correctly adjust the horizontal scrolling
The widget needs to use the naturalTextWidth to adjust the horizontal
scrolling, otherwise it will not fit correctly the text in the visible
area when resized.
Merge-request: 1410
Reviewed-by: Alan Alpert
Diffstat (limited to 'src/gui/widgets/qlineedit.cpp')
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 3065c7f..9571860 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1808,7 +1808,7 @@ void QLineEdit::paintEvent(QPaintEvent *) // (cix). int minLB = qMax(0, -fm.minLeftBearing()); int minRB = qMax(0, -fm.minRightBearing()); - int widthUsed = d->control->width() + minRB; + int widthUsed = qRound(d->control->naturalTextWidth()) + 1 + minRB; if ((minLB + widthUsed) <= lineRect.width()) { // text fits in lineRect; use hscroll for alignment switch (va & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { |