diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-09-09 12:58:38 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-09-09 13:01:41 (GMT) |
commit | 7e9ac1bab3527de054552ff3f38ab70945f49512 (patch) | |
tree | 0334b37927a5ab21f8b62c5f00faaec8fbc7ee2d /src/gui | |
parent | 01b1bb1ca1cd687b3bc276fc5374f8be8b3074b6 (diff) | |
download | Qt-7e9ac1bab3527de054552ff3f38ab70945f49512.zip Qt-7e9ac1bab3527de054552ff3f38ab70945f49512.tar.gz Qt-7e9ac1bab3527de054552ff3f38ab70945f49512.tar.bz2 |
Fixed the scrolling of text in QLineEdit with right alignment
The scrolling internal member was not changed in cas the text was
bigger than the lineedit.
Task-number: QTBUG-13520
Reviewed-by: gabi
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 981e934..caaef68 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1929,7 +1929,11 @@ void QLineEdit::paintEvent(QPaintEvent *) // text doesn't fit, text document is to the left of lineRect; align // right d->hscroll = widthUsed - lineRect.width() + 1; + } else { + //in case the text is bigger than the lineedit, the hscroll can never be negative + d->hscroll = qMax(0, d->hscroll); } + // the y offset is there to keep the baseline constant in case we have script changes in the text. QPoint topLeft = lineRect.topLeft() - QPoint(d->hscroll, d->control->ascent() - fm.ascent()); |