summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qlineedit.cpp
diff options
context:
space:
mode:
authorJerome Pasion <jerome.pasion@nokia.com>2010-09-16 13:50:28 (GMT)
committerJerome Pasion <jerome.pasion@nokia.com>2010-09-16 13:50:28 (GMT)
commit30b2a2669c03a3a0fc6a0cbb82ae1875121e2fb4 (patch)
tree6b8adae6b69e3fdc5d6cdd65b79307229957d421 /src/gui/widgets/qlineedit.cpp
parent3e7c69afd0c69b2fffccf4e8cb6f292366f3217f (diff)
parent53352584bbf81b577998b9f5a7dd2f7191870754 (diff)
downloadQt-30b2a2669c03a3a0fc6a0cbb82ae1875121e2fb4.zip
Qt-30b2a2669c03a3a0fc6a0cbb82ae1875121e2fb4.tar.gz
Qt-30b2a2669c03a3a0fc6a0cbb82ae1875121e2fb4.tar.bz2
Merge branch '13092010doc' of scm.dev.nokia.troll.no:qt/qt-doc-team into 13092010doc
Diffstat (limited to 'src/gui/widgets/qlineedit.cpp')
-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 a60b30d..0a33220 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1932,7 +1932,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());