summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-09-09 12:58:38 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2010-09-09 13:01:41 (GMT)
commit7e9ac1bab3527de054552ff3f38ab70945f49512 (patch)
tree0334b37927a5ab21f8b62c5f00faaec8fbc7ee2d /src/gui/widgets
parent01b1bb1ca1cd687b3bc276fc5374f8be8b3074b6 (diff)
downloadQt-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/widgets')
-rw-r--r--src/gui/widgets/qlineedit.cpp4
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());