summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-14 16:02:08 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-14 16:02:08 (GMT)
commit0f4505dd18a1342b62a049d4c37414179d6ec065 (patch)
tree3be71264d34e2ec7534a404634ae39f3cf47d497 /src/gui/widgets
parentb371999d3e9c207047be6afda89d008b6cf04763 (diff)
parent8876c7c44744b0813f98ebbb0f748331f9d8a22c (diff)
downloadQt-0f4505dd18a1342b62a049d4c37414179d6ec065.zip
Qt-0f4505dd18a1342b62a049d4c37414179d6ec065.tar.gz
Qt-0f4505dd18a1342b62a049d4c37414179d6ec065.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (21 commits) Added missing newline after warning message when using -L with qml Doc: updating scripts Fixed a crash on embedded due to uninitialized pointer. Fix a race where QThread::exit() is "lost" when called after start() qdoc: Removed all <table> attributes in favor of using css. Autotest failure: dialogModality test fails on cocoa (macgui) Force the bic test to compile in 32-bit mode on Mac Revert "Doc: Updating design files." Remove statically allocated pixmaps through the post routine qdoc: Checked for empty title. qdoc: Added TOC to class ref pages. Cocoa: qwidget autotest fails on setToolTip Compile on Mac OS 10.4 Bearer management changes from Qt Mobility (7a5ff985) Partially revert "Sunstudio12.1(5.10): Fix compile errors GTK style and other minor compile errors" Fix margins for placeholdertext in QLineEdit qdoc: Added TOC to module pages. Doc: Updating design files. Doc: Fixing design bugs. Updating the index page and script/style files. Adding some image files. qdoc: Changed <ul> elements in TOC. ...
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qlineedit.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 0b8dca9..655fc61 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1869,13 +1869,18 @@ void QLineEdit::paintEvent(QPaintEvent *)
}
QRect lineRect(r.x() + d->horizontalMargin, d->vscroll, r.width() - 2*d->horizontalMargin, fm.height());
+ int minLB = qMax(0, -fm.minLeftBearing());
+ int minRB = qMax(0, -fm.minRightBearing());
+
if (d->control->text().isEmpty()) {
if (!hasFocus() && !d->placeholderText.isEmpty()) {
QColor col = pal.text().color();
col.setAlpha(128);
QPen oldpen = p.pen();
p.setPen(col);
- p.drawText(lineRect, va, d->placeholderText);
+ lineRect.adjust(minLB, 0, 0, 0);
+ QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width());
+ p.drawText(lineRect, va, elidedText);
p.setPen(oldpen);
return;
}
@@ -1889,8 +1894,6 @@ void QLineEdit::paintEvent(QPaintEvent *)
// the below code handles all scrolling based on the textline (widthUsed,
// minLB, minRB), the line edit rect (lineRect) and the cursor position
// (cix).
- int minLB = qMax(0, -fm.minLeftBearing());
- int minRB = qMax(0, -fm.minRightBearing());
int widthUsed = qRound(d->control->naturalTextWidth()) + 1 + minRB;
if ((minLB + widthUsed) <= lineRect.width()) {
// text fits in lineRect; use hscroll for alignment