QPlatformTheme::removeMnemonics(): simplify space removal
Move the unrelated advance over the removed mnemonic to before space removal and dispense with the obfuscating extra variable counting how much space we remove. Change-Id: Ibb8b1aee0d7281ae21bc9c7aa7ee84289b800f5c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
fa4b7495b7
commit
6971bfab44
@ -834,13 +834,12 @@ QString QPlatformTheme::removeMnemonics(const QString &original)
|
||||
if (l == 0)
|
||||
break;
|
||||
} else if (l >= 4 && mnemonicInParentheses(QStringView{original}.sliced(currPos, 4))) {
|
||||
// Also strip any leading space before the mnemonic:
|
||||
int n = 0;
|
||||
while (finalDest > n && returnText.at(finalDest - n - 1).isSpace())
|
||||
++n;
|
||||
finalDest -= n;
|
||||
// Advance over the matched mnemonic:
|
||||
currPos += 4;
|
||||
l -= 4;
|
||||
// Also strip any leading space before it:
|
||||
while (finalDest > 0 && returnText.at(finalDest - 1).isSpace())
|
||||
--finalDest;
|
||||
continue;
|
||||
}
|
||||
returnText[finalDest] = original.at(currPos);
|
||||
|
Loading…
Reference in New Issue
Block a user