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>
This commit is contained in:
parent
9efd40bd77
commit
32983c2027
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user