diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-02-10 16:26:24 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2010-02-10 16:31:53 (GMT) |
commit | 620dd47c3b790b99f76793f4b4e6f22e3984558e (patch) | |
tree | 30113f199da2ec18d9f013e998d836915688cf9d /src/gui/text | |
parent | 5ab191af20bf2b1fed2b8886ac247c2953087c14 (diff) | |
download | Qt-620dd47c3b790b99f76793f4b4e6f22e3984558e.zip Qt-620dd47c3b790b99f76793f4b4e6f22e3984558e.tar.gz Qt-620dd47c3b790b99f76793f4b4e6f22e3984558e.tar.bz2 |
Blinking cursors are 2 pixels wide on Mac OS X/Cocoa.
Blinking cursors drawn in positions other than zero, can become 2 pixel
wide. This is caused by a rendering bug in the paint engine used by
Cocoa. If a fillRect() is called in a nox pixel boundary this engine
draws them 2 pixels wide instead of one. So make sure this is always on
a pixel boundary.
Task-number: QTBUG-8100
Reviewed-by: Trond
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 26c7c1e..af91603 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1331,7 +1331,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition QTextLine l(line, d); const QScriptLine &sl = d->lines[line]; - const qreal x = position.x() + l.cursorToX(cursorPosition); + qreal x = position.x() + l.cursorToX(cursorPosition); int itm = d->findItem(cursorPosition - 1); QFixed base = sl.base(); @@ -1350,6 +1350,10 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition && (p->transform().type() > QTransform::TxTranslate); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing); +#if defined(QT_MAC_USE_COCOA) + // Always draw the cursor aligned to pixel boundary. + x = qRound(x); +#endif p->fillRect(QRectF(x, y, qreal(width), (base + descent + 1).toReal()), p->pen().brush()); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing, false); |