summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-10 12:48:01 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-10 15:31:45 +0200
commit143c4d3e13a430b951f4f4f8c28db14303f80605 (patch)
tree2b89637b93fc7d81c674106008566010f986d67c /src/gui/text/qtextlayout.cpp
parenta7ed81b557d593a8ddb43b71bf4bbf3b44ead070 (diff)
parente5337ad1b1fb02873ce7b5ca8db45f6fd8063352 (diff)
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts: configure src/widgets/styles/qwindowsxpstyle.cpp tests/auto/gui/kernel/qwindow/qwindow.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r--src/gui/text/qtextlayout.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 95b8f48ec5..bec574bb83 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -506,6 +506,7 @@ QString QTextLayout::preeditAreaText() const
/*!
Sets the additional formats supported by the text layout to \a formatList.
+ The formats are applied with preedit area text in place.
\sa additionalFormats(), clearAdditionalFormats()
*/
@@ -2169,7 +2170,8 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
glyphRun.setFlags(flags);
glyphRun.setRawFont(font);
- glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY, selectionWidth.toReal(), height));
+ glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY - font.ascent(),
+ selectionWidth.toReal(), height));
return glyphRun;
}
@@ -2586,6 +2588,10 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
int pos = *cursorPos;
int itm;
const HB_CharAttributes *attributes = eng->attributes();
+ if (!attributes) {
+ *cursorPos = 0;
+ return x.toReal();
+ }
while (pos < line.from + line.length && !attributes[pos].charStop)
pos++;
if (pos == line.from + (int)line.length) {
@@ -2703,6 +2709,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
Converts the x-coordinate \a x, to the nearest matching cursor
position, depending on the cursor position type, \a cpos.
+ Note that result cursor position includes possible preedit area text.
\sa cursorToX()
*/