summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-04-22 09:04:29 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-04-22 09:25:54 +0200
commitaed5a7168354c6ae47687d20b4bd3f0adcc14f8e (patch)
treed2060479a7c12fdba8c1955e5d363754feffabb8 /src/gui/text
parentd3d10cf23d61f4a011f1a7e9abdee1a92717e80f (diff)
parent628fa13ea4d6ff0e2e2ee76c9adfc78676de3c59 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: src/corelib/statemachine/qstatemachine.cpp src/corelib/statemachine/qstatemachine_p.h src/gui/painting/qdrawhelper.cpp src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/plugins/platforms/xcb/qxcbwindow.h src/testlib/qtestblacklist.cpp src/tools/qdoc/node.cpp src/tools/qdoc/node.h tests/auto/gui/painting/qcolor/tst_qcolor.cpp Change-Id: I6c78b7b162001712d5774293f501b06b4ff32684
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/text/qtextcursor.cpp8
-rw-r--r--src/gui/text/qtextdocument.cpp3
-rw-r--r--src/gui/text/qtextengine.cpp15
-rw-r--r--src/gui/text/qtextengine_p.h1
-rw-r--r--src/gui/text/qtextformat.cpp4
-rw-r--r--src/gui/text/qtextlayout.cpp8
-rw-r--r--src/gui/text/qtextobject.cpp2
8 files changed, 14 insertions, 29 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 1a71042648..0f3cb21c70 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -356,7 +356,6 @@ struct QtFontFamily
populated(false),
fixedPitch(false),
name(n), count(0), foundries(0)
- , bogusWritingSystems(false)
, askedForFallback(false)
{
memset(writingSystems, 0, sizeof(writingSystems));
@@ -375,7 +374,6 @@ struct QtFontFamily
int count;
QtFontFoundry **foundries;
- bool bogusWritingSystems;
QStringList fallbackFamilies;
bool askedForFallback;
unsigned char writingSystems[QFontDatabase::WritingSystemsCount];
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index a151c515a3..eb51447105 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -424,9 +424,9 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
// skip if already at word start
QTextEngine *engine = layout->engine();
- engine->attributes();
+ const QCharAttributes *attributes = engine->attributes();
if ((relativePos == blockIt.length() - 1)
- && (engine->atSpace(relativePos - 1) || engine->atWordSeparator(relativePos - 1)))
+ && (attributes[relativePos - 1].whiteSpace || engine->atWordSeparator(relativePos - 1)))
return false;
if (relativePos < blockIt.length()-1)
@@ -499,7 +499,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
}
case QTextCursor::EndOfWord: {
QTextEngine *engine = layout->engine();
- engine->attributes();
+ const QCharAttributes *attributes = engine->attributes();
const int len = blockIt.length() - 1;
if (relativePos >= len)
return false;
@@ -508,7 +508,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
while (relativePos < len && engine->atWordSeparator(relativePos))
++relativePos;
} else {
- while (relativePos < len && !engine->atSpace(relativePos) && !engine->atWordSeparator(relativePos))
+ while (relativePos < len && !attributes[relativePos].whiteSpace && !engine->atWordSeparator(relativePos))
++relativePos;
}
newPosition = blockIt.position() + relativePos;
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index e8dd663354..d3b70aaf26 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1142,6 +1142,9 @@ void QTextDocument::setMetaInformation(MetaInformation info, const QString &stri
Returns the plain text contained in the document. If you want
formatting information use a QTextCursor instead.
+ \note Embedded objects, such as images, are represented by a
+ Unicode value U+FFFC (OBJECT REPLACEMENT CHARACTER).
+
\sa toHtml()
*/
QString QTextDocument::toPlainText() const
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 10a61d3c84..67a19804a3 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2549,21 +2549,6 @@ bool QTextEngine::atWordSeparator(int position) const
return false;
}
-bool QTextEngine::atSpace(int position) const
-{
- const QChar c = layoutData->string.at(position);
- switch (c.unicode()) {
- case QChar::Tabulation:
- case QChar::Space:
- case QChar::Nbsp:
- case QChar::LineSeparator:
- return true;
- default:
- break;
- }
- return false;
-}
-
void QTextEngine::setPreeditArea(int position, const QString &preeditText)
{
if (preeditText.isEmpty()) {
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 8037fd5f6d..39b9e0cb5a 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -592,7 +592,6 @@ private:
public:
bool atWordSeparator(int position) const;
- bool atSpace(int position) const;
QString elidedText(Qt::TextElideMode mode, const QFixed &width, int flags = 0, int from = 0, int count = -1) const;
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index a477aa2c99..d4eb1a4b0b 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -3027,8 +3027,8 @@ QTextTableFormat::QTextTableFormat(const QTextFormat &fmt)
\ingroup richtext-processing
\ingroup shared
- Inline images are represented by an object replacement character
- (0xFFFC in Unicode) which has an associated QTextImageFormat. The
+ Inline images are represented by a Unicode value U+FFFC (OBJECT
+ REPLACEMENT CHARACTER) which has an associated QTextImageFormat. The
image format specifies a name with setName() that is used to
locate the image. The size of the rectangle that the image will
occupy is specified using setWidth() and setHeight().
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index cab9f6ae61..7da3e84041 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -648,10 +648,10 @@ int QTextLayout::nextCursorPosition(int oldPos, CursorMode mode) const
while (oldPos < len && d->atWordSeparator(oldPos))
oldPos++;
} else {
- while (oldPos < len && !d->atSpace(oldPos) && !d->atWordSeparator(oldPos))
+ while (oldPos < len && !attributes[oldPos].whiteSpace && !d->atWordSeparator(oldPos))
oldPos++;
}
- while (oldPos < len && d->atSpace(oldPos))
+ while (oldPos < len && attributes[oldPos].whiteSpace)
oldPos++;
}
@@ -679,7 +679,7 @@ int QTextLayout::previousCursorPosition(int oldPos, CursorMode mode) const
while (oldPos && !attributes[oldPos].graphemeBoundary)
oldPos--;
} else {
- while (oldPos && d->atSpace(oldPos-1))
+ while (oldPos > 0 && attributes[oldPos - 1].whiteSpace)
oldPos--;
if (oldPos && d->atWordSeparator(oldPos-1)) {
@@ -687,7 +687,7 @@ int QTextLayout::previousCursorPosition(int oldPos, CursorMode mode) const
while (oldPos && d->atWordSeparator(oldPos-1))
oldPos--;
} else {
- while (oldPos && !d->atSpace(oldPos-1) && !d->atWordSeparator(oldPos-1))
+ while (oldPos > 0 && !attributes[oldPos - 1].whiteSpace && !d->atWordSeparator(oldPos-1))
oldPos--;
}
}
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index 425126d474..df7c8b9c71 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -1561,7 +1561,7 @@ QTextBlock QTextBlock::next() const
Returns the text block in the document before this block, or an empty text
block if this is the first one.
- Note that the next block may be in a different frame or table to this block.
+ Note that the previous block may be in a different frame or table to this block.
\sa next(), begin(), end()
*/