Changeset View
Changeset View
Standalone View
Standalone View
src/mnemonicattached.cpp
Show First 20 Lines • Show All 197 Lines • ▼ Show 20 Line(s) | 193 | if (!otherMa || otherMa->m_weight < m_weight) { | |||
---|---|---|---|---|---|
198 | } | 198 | } | ||
199 | 199 | | |||
200 | s_sequenceToObject[ks] = this; | 200 | s_sequenceToObject[ks] = this; | ||
201 | m_sequence = ks; | 201 | m_sequence = ks; | ||
202 | m_richTextLabel = text; | 202 | m_richTextLabel = text; | ||
203 | m_richTextLabel.replace(QRegularExpression(QLatin1String("\\&([^\\&])")), QStringLiteral("\\1")); | 203 | m_richTextLabel.replace(QRegularExpression(QLatin1String("\\&([^\\&])")), QStringLiteral("\\1")); | ||
204 | m_actualRichTextLabel = m_richTextLabel; | 204 | m_actualRichTextLabel = m_richTextLabel; | ||
205 | m_mnemonicLabel = m_richTextLabel; | 205 | m_mnemonicLabel = m_richTextLabel; | ||
206 | m_mnemonicLabel.replace(c, QLatin1String("&") % c); | 206 | const int mnemonicPos = m_mnemonicLabel.indexOf(c); | ||
207 | m_richTextLabel.replace(QString(c), QLatin1String("<u>") % c % QLatin1String("</u>")); | 207 | if (mnemonicPos > -1) { | ||
208 | m_mnemonicLabel.replace(mnemonicPos, 1, c); | ||||
209 | } | ||||
210 | const int richTextPos = m_richTextLabel.indexOf(c); | ||||
211 | if (richTextPos > -1) { | ||||
212 | m_richTextLabel.replace(richTextPos, 1, QLatin1String("<u>") % c % QLatin1String("</u>")); | ||||
213 | } | ||||
208 | 214 | | |||
209 | //remap the sequence of the previous shortcut | 215 | //remap the sequence of the previous shortcut | ||
210 | if (otherMa) { | 216 | if (otherMa) { | ||
211 | otherMa->updateSequence(); | 217 | otherMa->updateSequence(); | ||
212 | } | 218 | } | ||
213 | 219 | | |||
214 | break; | 220 | break; | ||
215 | } | 221 | } | ||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |