summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2013-03-16 02:57:17 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-02 22:23:28 +0200
commit32983c2027aed90b829fcdebf488f1de8945bcc8 (patch)
treed3ab665484d71bfe8aa60a20bea134f123ded114 /src/gui/text
parent9efd40bd776e1c5e7ce9feeac63b3673250291b6 (diff)
Improve QTextEngine::elidedText() in TextShowMnemonic mode
Check if the sequence is really a mnemonic and emulate grapheme cluster if so, rather than blindly reset the next character's attributes. This covers cases like "& ", "&<U+034F>", etc. Change-Id: Ibb063a2d258aff6455b9bb41bbe1a58a5036d0d6 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qtextengine.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 066282d09c..229db80186 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2422,12 +2422,13 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
const int end = si.position + length(&si);
for (int i = si.position; i < end - 1; ++i) {
- if (layoutData->string.at(i) == QLatin1Char('&')) {
+ if (layoutData->string.at(i) == QLatin1Char('&')
+ && !attributes[i + 1].whiteSpace && attributes[i + 1].graphemeBoundary) {
const int gp = logClusters[i - si.position];
glyphs.attributes[gp].dontPrint = true;
- attributes[i + 1].graphemeBoundary = false;
- attributes[i + 1].lineBreak = false;
- attributes[i + 1].whiteSpace = false;
+ // emulate grapheme cluster
+ attributes[i] = attributes[i + 1];
+ memset(attributes + i + 1, 0, sizeof(QCharAttributes));
if (layoutData->string.at(i + 1) == QLatin1Char('&'))
++i;
}