| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qwidgetlinecontrol.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||||||||
| 11 | int QWidgetLineControl::redoTextLayout() const | - | ||||||||||||||||||||||||||||||||||||
| 12 | { | - | ||||||||||||||||||||||||||||||||||||
| 13 | m_textLayout.clearLayout(); | - | ||||||||||||||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||||||||||||||
| 15 | m_textLayout.beginLayout(); | - | ||||||||||||||||||||||||||||||||||||
| 16 | QTextLine l = m_textLayout.createLine(); | - | ||||||||||||||||||||||||||||||||||||
| 17 | m_textLayout.endLayout(); | - | ||||||||||||||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||||||||||||||
| 24 | return never executed: qRound(l.ascent());return qRound(l.ascent());never executed: return qRound(l.ascent()); | 0 | ||||||||||||||||||||||||||||||||||||
| 25 | } | - | ||||||||||||||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||||||||||||||
| 33 | void QWidgetLineControl::updateDisplayText(bool forceUpdate) | - | ||||||||||||||||||||||||||||||||||||
| 34 | { | - | ||||||||||||||||||||||||||||||||||||
| 35 | QString orig = m_textLayout.text(); | - | ||||||||||||||||||||||||||||||||||||
| 36 | QString str; | - | ||||||||||||||||||||||||||||||||||||
| 37 | if (m_echoMode == QLineEdit::NoEcho
| 0 | ||||||||||||||||||||||||||||||||||||
| 38 | str = QString::fromLatin1(""); never executed: str = QString::fromLatin1(""); | 0 | ||||||||||||||||||||||||||||||||||||
| 39 | else | - | ||||||||||||||||||||||||||||||||||||
| 40 | str = m_text; never executed: str = m_text; | 0 | ||||||||||||||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||||||||||||||
| 42 | if (m_echoMode == QLineEdit::Password
| 0 | ||||||||||||||||||||||||||||||||||||
| 43 | str.fill(m_passwordCharacter); | - | ||||||||||||||||||||||||||||||||||||
| 44 | if (m_passwordEchoTimer != 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 45 | int cursor = m_cursor - 1; | - | ||||||||||||||||||||||||||||||||||||
| 46 | QChar uc = m_text.at(cursor); | - | ||||||||||||||||||||||||||||||||||||
| 47 | str[cursor] = uc; | - | ||||||||||||||||||||||||||||||||||||
| 48 | if (cursor > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||||||||||||||
| 50 | - | |||||||||||||||||||||||||||||||||||||
| 51 | uc = m_text.at(cursor - 1); | - | ||||||||||||||||||||||||||||||||||||
| 52 | if (uc.isHighSurrogate()
| 0 | ||||||||||||||||||||||||||||||||||||
| 53 | str[cursor - 1] = uc; never executed: str[cursor - 1] = uc; | 0 | ||||||||||||||||||||||||||||||||||||
| 54 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 55 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 56 | } never executed: else if (m_echoMode == QLineEdit::PasswordEchoOnEditend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 57 | str.fill(m_passwordCharacter); | - | ||||||||||||||||||||||||||||||||||||
| 58 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||||||||||||||
| 63 | QChar* uc = str.data(); | - | ||||||||||||||||||||||||||||||||||||
| 64 | for (int i = 0; i < (int)str.length()
| 0 | ||||||||||||||||||||||||||||||||||||
| 65 | if ((uc[i].unicode() < 0x20
| 0 | ||||||||||||||||||||||||||||||||||||
| 66 | || uc[i] == QChar::LineSeparator
| 0 | ||||||||||||||||||||||||||||||||||||
| 67 | || uc[i] == QChar::ParagraphSeparator
| 0 | ||||||||||||||||||||||||||||||||||||
| 68 | || uc[i] == QChar::ObjectReplacementCharacter
| 0 | ||||||||||||||||||||||||||||||||||||
| 69 | uc[i] = QChar(0x0020); never executed: uc[i] = QChar(0x0020); | 0 | ||||||||||||||||||||||||||||||||||||
| 70 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||||||||||||||
| 72 | m_textLayout.setText(str); | - | ||||||||||||||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||||||||||||||
| 74 | QTextOption option = m_textLayout.textOption(); | - | ||||||||||||||||||||||||||||||||||||
| 75 | option.setTextDirection(m_layoutDirection); | - | ||||||||||||||||||||||||||||||||||||
| 76 | option.setFlags(QTextOption::IncludeTrailingSpaces); | - | ||||||||||||||||||||||||||||||||||||
| 77 | m_textLayout.setTextOption(option); | - | ||||||||||||||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||||||||||||||
| 79 | m_ascent = redoTextLayout(); | - | ||||||||||||||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||||||||||||||
| 81 | if (str != orig
| 0 | ||||||||||||||||||||||||||||||||||||
| 82 | displayTextChanged(str); never executed: displayTextChanged(str); | 0 | ||||||||||||||||||||||||||||||||||||
| 83 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 84 | void QWidgetLineControl::copy(QClipboard::Mode mode) const | - | ||||||||||||||||||||||||||||||||||||
| 85 | { | - | ||||||||||||||||||||||||||||||||||||
| 86 | QString t = selectedText(); | - | ||||||||||||||||||||||||||||||||||||
| 87 | if (!t.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 88 | QApplication::clipboard()->setText(t, mode); | - | ||||||||||||||||||||||||||||||||||||
| 89 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 90 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 91 | void QWidgetLineControl::paste(QClipboard::Mode clipboardMode) | - | ||||||||||||||||||||||||||||||||||||
| 92 | { | - | ||||||||||||||||||||||||||||||||||||
| 93 | QString clip = QApplication::clipboard()->text(clipboardMode); | - | ||||||||||||||||||||||||||||||||||||
| 94 | if (!clip.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 95 | separate(); | - | ||||||||||||||||||||||||||||||||||||
| 96 | insert(clip); | - | ||||||||||||||||||||||||||||||||||||
| 97 | separate(); | - | ||||||||||||||||||||||||||||||||||||
| 98 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 99 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||||||||||||||
| 106 | void QWidgetLineControl::commitPreedit() | - | ||||||||||||||||||||||||||||||||||||
| 107 | { | - | ||||||||||||||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||||||||||||||
| 109 | if (!composeMode()
| 0 | ||||||||||||||||||||||||||||||||||||
| 110 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||||||||||||||
| 112 | QGuiApplication::inputMethod()->commit(); | - | ||||||||||||||||||||||||||||||||||||
| 113 | if (!composeMode()
| 0 | ||||||||||||||||||||||||||||||||||||
| 114 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||||||||||||||
| 116 | m_preeditCursor = 0; | - | ||||||||||||||||||||||||||||||||||||
| 117 | setPreeditArea(-1, QString()); | - | ||||||||||||||||||||||||||||||||||||
| 118 | m_textLayout.clearFormats(); | - | ||||||||||||||||||||||||||||||||||||
| 119 | updateDisplayText( true); | - | ||||||||||||||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||||||||||||||
| 121 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 122 | void QWidgetLineControl::backspace() | - | ||||||||||||||||||||||||||||||||||||
| 123 | { | - | ||||||||||||||||||||||||||||||||||||
| 124 | int priorState = m_undoState; | - | ||||||||||||||||||||||||||||||||||||
| 125 | if (hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 126 | removeSelectedText(); | - | ||||||||||||||||||||||||||||||||||||
| 127 | } never executed: else if (m_cursorend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 128 | --m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 129 | if (m_maskData
| 0 | ||||||||||||||||||||||||||||||||||||
| 130 | m_cursor = prevMaskBlank(m_cursor); never executed: m_cursor = prevMaskBlank(m_cursor); | 0 | ||||||||||||||||||||||||||||||||||||
| 131 | QChar uc = m_text.at(m_cursor); | - | ||||||||||||||||||||||||||||||||||||
| 132 | if (m_cursor > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||||||||||||||
| 135 | uc = m_text.at(m_cursor - 1); | - | ||||||||||||||||||||||||||||||||||||
| 136 | if (uc.isHighSurrogate()
| 0 | ||||||||||||||||||||||||||||||||||||
| 137 | internalDelete(true); | - | ||||||||||||||||||||||||||||||||||||
| 138 | --m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 139 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 140 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 141 | internalDelete(true); | - | ||||||||||||||||||||||||||||||||||||
| 142 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 143 | finishChange(priorState); | - | ||||||||||||||||||||||||||||||||||||
| 144 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 145 | void QWidgetLineControl::del() | - | ||||||||||||||||||||||||||||||||||||
| 146 | { | - | ||||||||||||||||||||||||||||||||||||
| 147 | int priorState = m_undoState; | - | ||||||||||||||||||||||||||||||||||||
| 148 | if (hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 149 | removeSelectedText(); | - | ||||||||||||||||||||||||||||||||||||
| 150 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 151 | int n = textLayout()->nextCursorPosition(m_cursor) - m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 152 | while (n--
| 0 | ||||||||||||||||||||||||||||||||||||
| 153 | internalDelete(); never executed: internalDelete(); | 0 | ||||||||||||||||||||||||||||||||||||
| 154 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 155 | finishChange(priorState); | - | ||||||||||||||||||||||||||||||||||||
| 156 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 157 | void QWidgetLineControl::insert(const QString &newText) | - | ||||||||||||||||||||||||||||||||||||
| 158 | { | - | ||||||||||||||||||||||||||||||||||||
| 159 | int priorState = m_undoState; | - | ||||||||||||||||||||||||||||||||||||
| 160 | removeSelectedText(); | - | ||||||||||||||||||||||||||||||||||||
| 161 | internalInsert(newText); | - | ||||||||||||||||||||||||||||||||||||
| 162 | finishChange(priorState); | - | ||||||||||||||||||||||||||||||||||||
| 163 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||||||||||||||
| 166 | - | |||||||||||||||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||||||||||||||
| 170 | void QWidgetLineControl::clear() | - | ||||||||||||||||||||||||||||||||||||
| 171 | { | - | ||||||||||||||||||||||||||||||||||||
| 172 | int priorState = m_undoState; | - | ||||||||||||||||||||||||||||||||||||
| 173 | m_selstart = 0; | - | ||||||||||||||||||||||||||||||||||||
| 174 | m_selend = m_text.length(); | - | ||||||||||||||||||||||||||||||||||||
| 175 | removeSelectedText(); | - | ||||||||||||||||||||||||||||||||||||
| 176 | separate(); | - | ||||||||||||||||||||||||||||||||||||
| 177 | finishChange(priorState, false, false); | - | ||||||||||||||||||||||||||||||||||||
| 178 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||||||||||||||
| 182 | - | |||||||||||||||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||||||||||||||
| 185 | void QWidgetLineControl::undo() | - | ||||||||||||||||||||||||||||||||||||
| 186 | { | - | ||||||||||||||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||||||||||||||
| 188 | if (m_echoMode == QLineEdit::Normal
| 0 | ||||||||||||||||||||||||||||||||||||
| 189 | internalUndo(); | - | ||||||||||||||||||||||||||||||||||||
| 190 | finishChange(-1, true); | - | ||||||||||||||||||||||||||||||||||||
| 191 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 192 | cancelPasswordEchoTimer(); | - | ||||||||||||||||||||||||||||||||||||
| 193 | clear(); | - | ||||||||||||||||||||||||||||||||||||
| 194 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 195 | } | - | ||||||||||||||||||||||||||||||||||||
| 196 | void QWidgetLineControl::setSelection(int start, int length) | - | ||||||||||||||||||||||||||||||||||||
| 197 | { | - | ||||||||||||||||||||||||||||||||||||
| 198 | commitPreedit(); | - | ||||||||||||||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||||||||||||||
| 200 | if (__builtin_expect(!!(start < 0 || start > m_text.size()), false)
| 0 | ||||||||||||||||||||||||||||||||||||
| 201 | QMessageLogger(__FILE__, 316, __PRETTY_FUNCTION__).warning("QWidgetLineControl::setSelection: Invalid start position"); | - | ||||||||||||||||||||||||||||||||||||
| 202 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 203 | } | - | ||||||||||||||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||||||||||||||
| 205 | if (length > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 206 | if (start == m_selstart
| 0 | ||||||||||||||||||||||||||||||||||||
| 207 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 208 | m_selstart = start; | - | ||||||||||||||||||||||||||||||||||||
| 209 | m_selend = qMin(start + length, (int)m_text.length()); | - | ||||||||||||||||||||||||||||||||||||
| 210 | m_cursor = m_selend; | - | ||||||||||||||||||||||||||||||||||||
| 211 | } never executed: else if (length < 0end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 212 | if (start == m_selend
| 0 | ||||||||||||||||||||||||||||||||||||
| 213 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 214 | m_selstart = qMax(start + length, 0); | - | ||||||||||||||||||||||||||||||||||||
| 215 | m_selend = start; | - | ||||||||||||||||||||||||||||||||||||
| 216 | m_cursor = m_selstart; | - | ||||||||||||||||||||||||||||||||||||
| 217 | } never executed: else if (m_selstart != m_selendend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 218 | m_selstart = 0; | - | ||||||||||||||||||||||||||||||||||||
| 219 | m_selend = 0; | - | ||||||||||||||||||||||||||||||||||||
| 220 | m_cursor = start; | - | ||||||||||||||||||||||||||||||||||||
| 221 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 222 | m_cursor = start; | - | ||||||||||||||||||||||||||||||||||||
| 223 | emitCursorPositionChanged(); | - | ||||||||||||||||||||||||||||||||||||
| 224 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 225 | } | - | ||||||||||||||||||||||||||||||||||||
| 226 | selectionChanged(); | - | ||||||||||||||||||||||||||||||||||||
| 227 | emitCursorPositionChanged(); | - | ||||||||||||||||||||||||||||||||||||
| 228 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||||||||||||||
| 230 | void QWidgetLineControl::_q_deleteSelected() | - | ||||||||||||||||||||||||||||||||||||
| 231 | { | - | ||||||||||||||||||||||||||||||||||||
| 232 | if (!hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 233 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||||||||||||||
| 235 | int priorState = m_undoState; | - | ||||||||||||||||||||||||||||||||||||
| 236 | resetInputContext(); | - | ||||||||||||||||||||||||||||||||||||
| 237 | removeSelectedText(); | - | ||||||||||||||||||||||||||||||||||||
| 238 | separate(); | - | ||||||||||||||||||||||||||||||||||||
| 239 | finishChange(priorState); | - | ||||||||||||||||||||||||||||||||||||
| 240 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||||||||||||||
| 247 | void QWidgetLineControl::init(const QString &txt) | - | ||||||||||||||||||||||||||||||||||||
| 248 | { | - | ||||||||||||||||||||||||||||||||||||
| 249 | m_textLayout.setCacheEnabled(true); | - | ||||||||||||||||||||||||||||||||||||
| 250 | m_text = txt; | - | ||||||||||||||||||||||||||||||||||||
| 251 | updateDisplayText(); | - | ||||||||||||||||||||||||||||||||||||
| 252 | m_cursor = m_text.length(); | - | ||||||||||||||||||||||||||||||||||||
| 253 | if (const
| 0 | ||||||||||||||||||||||||||||||||||||
| 254 | m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 255 | m_passwordMaskDelay = theme->themeHint(QPlatformTheme::PasswordMaskDelay).toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 256 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||||||||||||||
| 258 | if (m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme
| 0 | ||||||||||||||||||||||||||||||||||||
| 259 | || m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
| 0 | ||||||||||||||||||||||||||||||||||||
| 260 | || m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme
| 0 | ||||||||||||||||||||||||||||||||||||
| 261 | m_keyboardScheme = QPlatformTheme::X11KeyboardScheme; | - | ||||||||||||||||||||||||||||||||||||
| 262 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 263 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 264 | void QWidgetLineControl::updatePasswordEchoEditing(bool editing) | - | ||||||||||||||||||||||||||||||||||||
| 265 | { | - | ||||||||||||||||||||||||||||||||||||
| 266 | cancelPasswordEchoTimer(); | - | ||||||||||||||||||||||||||||||||||||
| 267 | m_passwordEchoEditing = editing; | - | ||||||||||||||||||||||||||||||||||||
| 268 | updateDisplayText(); | - | ||||||||||||||||||||||||||||||||||||
| 269 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 270 | int QWidgetLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const | - | ||||||||||||||||||||||||||||||||||||
| 271 | { | - | ||||||||||||||||||||||||||||||||||||
| 272 | return never executed: textLayout()->lineAt(0).xToCursor(x, betweenOrOn);return textLayout()->lineAt(0).xToCursor(x, betweenOrOn);never executed: return textLayout()->lineAt(0).xToCursor(x, betweenOrOn); | 0 | ||||||||||||||||||||||||||||||||||||
| 273 | } | - | ||||||||||||||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||||||||||||||
| 279 | - | |||||||||||||||||||||||||||||||||||||
| 280 | QRect QWidgetLineControl::rectForPos(int pos) const | - | ||||||||||||||||||||||||||||||||||||
| 281 | { | - | ||||||||||||||||||||||||||||||||||||
| 282 | QTextLine l = textLayout()->lineAt(0); | - | ||||||||||||||||||||||||||||||||||||
| 283 | if (m_preeditCursor != -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 284 | pos += m_preeditCursor; never executed: pos += m_preeditCursor; | 0 | ||||||||||||||||||||||||||||||||||||
| 285 | int cix = qRound(l.cursorToX(pos)); | - | ||||||||||||||||||||||||||||||||||||
| 286 | int w = m_cursorWidth; | - | ||||||||||||||||||||||||||||||||||||
| 287 | int ch = l.height() + 1; | - | ||||||||||||||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||||||||||||||
| 289 | return never executed: QRect(cix-5, 0, w+9, ch);return QRect(cix-5, 0, w+9, ch);never executed: return QRect(cix-5, 0, w+9, ch); | 0 | ||||||||||||||||||||||||||||||||||||
| 290 | } | - | ||||||||||||||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||||||||||||||
| 298 | QRect QWidgetLineControl::cursorRect() const | - | ||||||||||||||||||||||||||||||||||||
| 299 | { | - | ||||||||||||||||||||||||||||||||||||
| 300 | return never executed: rectForPos(m_cursor);return rectForPos(m_cursor);never executed: return rectForPos(m_cursor); | 0 | ||||||||||||||||||||||||||||||||||||
| 301 | } | - | ||||||||||||||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||||||||||||||
| 308 | QRect QWidgetLineControl::anchorRect() const | - | ||||||||||||||||||||||||||||||||||||
| 309 | { | - | ||||||||||||||||||||||||||||||||||||
| 310 | if (!hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 311 | return never executed: cursorRect();return cursorRect();never executed: return cursorRect(); | 0 | ||||||||||||||||||||||||||||||||||||
| 312 | return never executed: rectForPos(m_selstart < m_selend ? m_selstart : m_selend);return rectForPos(m_selstart < m_selend ? m_selstart : m_selend);never executed: return rectForPos(m_selstart < m_selend ? m_selstart : m_selend); | 0 | ||||||||||||||||||||||||||||||||||||
| 313 | } | - | ||||||||||||||||||||||||||||||||||||
| 314 | bool QWidgetLineControl::fixup() | - | ||||||||||||||||||||||||||||||||||||
| 315 | { | - | ||||||||||||||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||||||||||||||
| 317 | if (m_validator
| 0 | ||||||||||||||||||||||||||||||||||||
| 318 | QString textCopy = m_text; | - | ||||||||||||||||||||||||||||||||||||
| 319 | int cursorCopy = m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 320 | m_validator->fixup(textCopy); | - | ||||||||||||||||||||||||||||||||||||
| 321 | if (m_validator->validate(textCopy, cursorCopy) == QValidator::Acceptable
| 0 | ||||||||||||||||||||||||||||||||||||
| 322 | if (textCopy != m_text
| 0 | ||||||||||||||||||||||||||||||||||||
| 323 | internalSetText(textCopy, cursorCopy, false); never executed: internalSetText(textCopy, cursorCopy, false); | 0 | ||||||||||||||||||||||||||||||||||||
| 324 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 325 | } | - | ||||||||||||||||||||||||||||||||||||
| 326 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||||||||||||||
| 328 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 329 | } | - | ||||||||||||||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||||||||||||||
| 337 | void QWidgetLineControl::moveCursor(int pos, bool mark) | - | ||||||||||||||||||||||||||||||||||||
| 338 | { | - | ||||||||||||||||||||||||||||||||||||
| 339 | commitPreedit(); | - | ||||||||||||||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||||||||||||||
| 341 | if (pos != m_cursor
| 0 | ||||||||||||||||||||||||||||||||||||
| 342 | separate(); | - | ||||||||||||||||||||||||||||||||||||
| 343 | if (m_maskData
| 0 | ||||||||||||||||||||||||||||||||||||
| 344 | pos = pos > m_cursor
never executed: pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos); | 0 | ||||||||||||||||||||||||||||||||||||
| 345 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 346 | if (mark
| 0 | ||||||||||||||||||||||||||||||||||||
| 347 | int anchor; | - | ||||||||||||||||||||||||||||||||||||
| 348 | if (m_selend > m_selstart
| 0 | ||||||||||||||||||||||||||||||||||||
| 349 | anchor = m_selend; never executed: anchor = m_selend; | 0 | ||||||||||||||||||||||||||||||||||||
| 350 | else if (m_selend > m_selstart
| 0 | ||||||||||||||||||||||||||||||||||||
| 351 | anchor = m_selstart; never executed: anchor = m_selstart; | 0 | ||||||||||||||||||||||||||||||||||||
| 352 | else | - | ||||||||||||||||||||||||||||||||||||
| 353 | anchor = m_cursor; never executed: anchor = m_cursor; | 0 | ||||||||||||||||||||||||||||||||||||
| 354 | m_selstart = qMin(anchor, pos); | - | ||||||||||||||||||||||||||||||||||||
| 355 | m_selend = qMax(anchor, pos); | - | ||||||||||||||||||||||||||||||||||||
| 356 | updateDisplayText(); | - | ||||||||||||||||||||||||||||||||||||
| 357 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 358 | internalDeselect(); | - | ||||||||||||||||||||||||||||||||||||
| 359 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 360 | m_cursor = pos; | - | ||||||||||||||||||||||||||||||||||||
| 361 | if (mark
| 0 | ||||||||||||||||||||||||||||||||||||
| 362 | m_selDirty = false; | - | ||||||||||||||||||||||||||||||||||||
| 363 | selectionChanged(); | - | ||||||||||||||||||||||||||||||||||||
| 364 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 365 | emitCursorPositionChanged(); | - | ||||||||||||||||||||||||||||||||||||
| 366 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||||||||||||||
| 369 | - | |||||||||||||||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||||||||||||||
| 374 | void QWidgetLineControl::processInputMethodEvent(QInputMethodEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 375 | { | - | ||||||||||||||||||||||||||||||||||||
| 376 | int priorState = -1; | - | ||||||||||||||||||||||||||||||||||||
| 377 | bool isGettingInput = !event->commitString().isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 378 | || event->preeditString() != preeditAreaText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 379 | || event->replacementLength() > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 380 | bool cursorPositionChanged = false; | - | ||||||||||||||||||||||||||||||||||||
| 381 | bool selectionChange = false; | - | ||||||||||||||||||||||||||||||||||||
| 382 | - | |||||||||||||||||||||||||||||||||||||
| 383 | if (isGettingInput
| 0 | ||||||||||||||||||||||||||||||||||||
| 384 | - | |||||||||||||||||||||||||||||||||||||
| 385 | priorState = m_undoState; | - | ||||||||||||||||||||||||||||||||||||
| 386 | if (echoMode() == QLineEdit::PasswordEchoOnEdit
| 0 | ||||||||||||||||||||||||||||||||||||
| 387 | updatePasswordEchoEditing(true); | - | ||||||||||||||||||||||||||||||||||||
| 388 | m_selstart = 0; | - | ||||||||||||||||||||||||||||||||||||
| 389 | m_selend = m_text.length(); | - | ||||||||||||||||||||||||||||||||||||
| 390 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 391 | removeSelectedText(); | - | ||||||||||||||||||||||||||||||||||||
| 392 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||||||||||||||
| 394 | int c = m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 395 | if (event->replacementStart() <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 396 | c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength()); never executed: c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength()); | 0 | ||||||||||||||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||||||||||||||
| 398 | m_cursor += event->replacementStart(); | - | ||||||||||||||||||||||||||||||||||||
| 399 | if (m_cursor < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 400 | m_cursor = 0; never executed: m_cursor = 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||||||||||||||
| 403 | if (event->replacementLength()
| 0 | ||||||||||||||||||||||||||||||||||||
| 404 | m_selstart = m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 405 | m_selend = m_selstart + event->replacementLength(); | - | ||||||||||||||||||||||||||||||||||||
| 406 | removeSelectedText(); | - | ||||||||||||||||||||||||||||||||||||
| 407 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 408 | if (!event->commitString().isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 409 | internalInsert(event->commitString()); | - | ||||||||||||||||||||||||||||||||||||
| 410 | cursorPositionChanged = true; | - | ||||||||||||||||||||||||||||||||||||
| 411 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 412 | - | |||||||||||||||||||||||||||||||||||||
| 413 | m_cursor = qBound(0, c, m_text.length()); | - | ||||||||||||||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||||||||||||||
| 415 | for (int i = 0; i < event->attributes().size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 416 | const QInputMethodEvent::Attribute &a = event->attributes().at(i); | - | ||||||||||||||||||||||||||||||||||||
| 417 | if (a.type == QInputMethodEvent::Selection
| 0 | ||||||||||||||||||||||||||||||||||||
| 418 | m_cursor = qBound(0, a.start + a.length, m_text.length()); | - | ||||||||||||||||||||||||||||||||||||
| 419 | if (a.length
| 0 | ||||||||||||||||||||||||||||||||||||
| 420 | m_selstart = qMax(0, qMin(a.start, m_text.length())); | - | ||||||||||||||||||||||||||||||||||||
| 421 | m_selend = m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 422 | if (m_selend < m_selstart
| 0 | ||||||||||||||||||||||||||||||||||||
| 423 | qSwap(m_selstart, m_selend); | - | ||||||||||||||||||||||||||||||||||||
| 424 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 425 | selectionChange = true; | - | ||||||||||||||||||||||||||||||||||||
| 426 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 427 | if (m_selstart != m_selend
| 0 | ||||||||||||||||||||||||||||||||||||
| 428 | selectionChange = true; never executed: selectionChange = true; | 0 | ||||||||||||||||||||||||||||||||||||
| 429 | m_selstart = m_selend = 0; | - | ||||||||||||||||||||||||||||||||||||
| 430 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 431 | cursorPositionChanged = true; | - | ||||||||||||||||||||||||||||||||||||
| 432 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 433 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||||||||||||||
| 435 | setPreeditArea(m_cursor, event->preeditString()); | - | ||||||||||||||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||||||||||||||
| 437 | const int oldPreeditCursor = m_preeditCursor; | - | ||||||||||||||||||||||||||||||||||||
| 438 | m_preeditCursor = event->preeditString().length(); | - | ||||||||||||||||||||||||||||||||||||
| 439 | m_hideCursor = false; | - | ||||||||||||||||||||||||||||||||||||
| 440 | QVector<QTextLayout::FormatRange> formats; | - | ||||||||||||||||||||||||||||||||||||
| 441 | formats.reserve(event->attributes().size()); | - | ||||||||||||||||||||||||||||||||||||
| 442 | for (int i = 0; i < event->attributes().size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 443 | const QInputMethodEvent::Attribute &a = event->attributes().at(i); | - | ||||||||||||||||||||||||||||||||||||
| 444 | if (a.type == QInputMethodEvent::Cursor
| 0 | ||||||||||||||||||||||||||||||||||||
| 445 | m_preeditCursor = a.start; | - | ||||||||||||||||||||||||||||||||||||
| 446 | m_hideCursor = !a.length; | - | ||||||||||||||||||||||||||||||||||||
| 447 | } never executed: else if (a.type == QInputMethodEvent::TextFormatend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 448 | QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat(); | - | ||||||||||||||||||||||||||||||||||||
| 449 | if (f.isValid()
| 0 | ||||||||||||||||||||||||||||||||||||
| 450 | QTextLayout::FormatRange o; | - | ||||||||||||||||||||||||||||||||||||
| 451 | o.start = a.start + m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 452 | o.length = a.length; | - | ||||||||||||||||||||||||||||||||||||
| 453 | o.format = f; | - | ||||||||||||||||||||||||||||||||||||
| 454 | formats.append(o); | - | ||||||||||||||||||||||||||||||||||||
| 455 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 456 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 457 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 458 | m_textLayout.setFormats(formats); | - | ||||||||||||||||||||||||||||||||||||
| 459 | updateDisplayText( true); | - | ||||||||||||||||||||||||||||||||||||
| 460 | if (cursorPositionChanged
| 0 | ||||||||||||||||||||||||||||||||||||
| 461 | emitCursorPositionChanged(); never executed: emitCursorPositionChanged(); | 0 | ||||||||||||||||||||||||||||||||||||
| 462 | else if (m_preeditCursor != oldPreeditCursor
| 0 | ||||||||||||||||||||||||||||||||||||
| 463 | updateMicroFocus(); never executed: updateMicroFocus(); | 0 | ||||||||||||||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||||||||||||||
| 465 | if (isGettingInput
| 0 | ||||||||||||||||||||||||||||||||||||
| 466 | finishChange(priorState); never executed: finishChange(priorState); | 0 | ||||||||||||||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||||||||||||||
| 468 | if (selectionChange
| 0 | ||||||||||||||||||||||||||||||||||||
| 469 | selectionChanged(); never executed: selectionChanged(); | 0 | ||||||||||||||||||||||||||||||||||||
| 470 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 471 | void QWidgetLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &clip, int flags) | - | ||||||||||||||||||||||||||||||||||||
| 472 | { | - | ||||||||||||||||||||||||||||||||||||
| 473 | QVector<QTextLayout::FormatRange> selections; | - | ||||||||||||||||||||||||||||||||||||
| 474 | if (flags & DrawSelections
| 0 | ||||||||||||||||||||||||||||||||||||
| 475 | QTextLayout::FormatRange o; | - | ||||||||||||||||||||||||||||||||||||
| 476 | if (m_selstart < m_selend
| 0 | ||||||||||||||||||||||||||||||||||||
| 477 | o.start = m_selstart; | - | ||||||||||||||||||||||||||||||||||||
| 478 | o.length = m_selend - m_selstart; | - | ||||||||||||||||||||||||||||||||||||
| 479 | o.format.setBackground(m_palette.brush(QPalette::Highlight)); | - | ||||||||||||||||||||||||||||||||||||
| 480 | o.format.setForeground(m_palette.brush(QPalette::HighlightedText)); | - | ||||||||||||||||||||||||||||||||||||
| 481 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||||||||||||||
| 483 | if (m_blinkStatus
| 0 | ||||||||||||||||||||||||||||||||||||
| 484 | o.start = m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 485 | o.length = 1; | - | ||||||||||||||||||||||||||||||||||||
| 486 | o.format.setBackground(m_palette.brush(QPalette::Text)); | - | ||||||||||||||||||||||||||||||||||||
| 487 | o.format.setForeground(m_palette.brush(QPalette::Window)); | - | ||||||||||||||||||||||||||||||||||||
| 488 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 489 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 490 | selections.append(o); | - | ||||||||||||||||||||||||||||||||||||
| 491 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||||||||||||||
| 493 | if (flags & DrawText
| 0 | ||||||||||||||||||||||||||||||||||||
| 494 | textLayout()->draw(painter, offset, selections, clip); never executed: textLayout()->draw(painter, offset, selections, clip); | 0 | ||||||||||||||||||||||||||||||||||||
| 495 | - | |||||||||||||||||||||||||||||||||||||
| 496 | if (flags & DrawCursor
| 0 | ||||||||||||||||||||||||||||||||||||
| 497 | int cursor = m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 498 | if (m_preeditCursor != -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 499 | cursor += m_preeditCursor; never executed: cursor += m_preeditCursor; | 0 | ||||||||||||||||||||||||||||||||||||
| 500 | if (!m_hideCursor
| 0 | ||||||||||||||||||||||||||||||||||||
| 501 | textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth); never executed: textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth); | 0 | ||||||||||||||||||||||||||||||||||||
| 502 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 503 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 504 | void QWidgetLineControl::selectWordAtPos(int cursor) | - | ||||||||||||||||||||||||||||||||||||
| 505 | { | - | ||||||||||||||||||||||||||||||||||||
| 506 | int next = cursor + 1; | - | ||||||||||||||||||||||||||||||||||||
| 507 | if(next > end()
| 0 | ||||||||||||||||||||||||||||||||||||
| 508 | -- never executed: next;--next;never executed: --next; | 0 | ||||||||||||||||||||||||||||||||||||
| 509 | int c = textLayout()->previousCursorPosition(next, QTextLayout::SkipWords); | - | ||||||||||||||||||||||||||||||||||||
| 510 | moveCursor(c, false); | - | ||||||||||||||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||||||||||||||
| 512 | int end = textLayout()->nextCursorPosition(c, QTextLayout::SkipWords); | - | ||||||||||||||||||||||||||||||||||||
| 513 | while (end > cursor
| 0 | ||||||||||||||||||||||||||||||||||||
| 514 | -- never executed: end;--end;never executed: --end; | 0 | ||||||||||||||||||||||||||||||||||||
| 515 | moveCursor(end, true); | - | ||||||||||||||||||||||||||||||||||||
| 516 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 517 | bool QWidgetLineControl::finishChange(int validateFromState, bool update, bool edited) | - | ||||||||||||||||||||||||||||||||||||
| 518 | { | - | ||||||||||||||||||||||||||||||||||||
| 519 | (void)update; | - | ||||||||||||||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||||||||||||||
| 521 | if (m_textDirty
| 0 | ||||||||||||||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||||||||||||||
| 523 | bool wasValidInput = m_validInput; | - | ||||||||||||||||||||||||||||||||||||
| 524 | m_validInput = true; | - | ||||||||||||||||||||||||||||||||||||
| 525 | - | |||||||||||||||||||||||||||||||||||||
| 526 | if (m_validator
| 0 | ||||||||||||||||||||||||||||||||||||
| 527 | QString textCopy = m_text; | - | ||||||||||||||||||||||||||||||||||||
| 528 | int cursorCopy = m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 529 | m_validInput = (m_validator->validate(textCopy, cursorCopy) != QValidator::Invalid); | - | ||||||||||||||||||||||||||||||||||||
| 530 | if (m_validInput
| 0 | ||||||||||||||||||||||||||||||||||||
| 531 | if (m_text != textCopy
| 0 | ||||||||||||||||||||||||||||||||||||
| 532 | internalSetText(textCopy, cursorCopy, false); | - | ||||||||||||||||||||||||||||||||||||
| 533 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 534 | } | - | ||||||||||||||||||||||||||||||||||||
| 535 | m_cursor = cursorCopy; | - | ||||||||||||||||||||||||||||||||||||
| 536 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 537 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||||||||||||||
| 539 | if (validateFromState >= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 540 | if (m_transactions.count()
| 0 | ||||||||||||||||||||||||||||||||||||
| 541 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 542 | internalUndo(validateFromState); | - | ||||||||||||||||||||||||||||||||||||
| 543 | m_history.erase(m_history.begin() + m_undoState, m_history.end()); | - | ||||||||||||||||||||||||||||||||||||
| 544 | if (m_modifiedState > m_undoState
| 0 | ||||||||||||||||||||||||||||||||||||
| 545 | m_modifiedState = -1; never executed: m_modifiedState = -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 546 | m_validInput = true; | - | ||||||||||||||||||||||||||||||||||||
| 547 | m_textDirty = false; | - | ||||||||||||||||||||||||||||||||||||
| 548 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 549 | updateDisplayText(); | - | ||||||||||||||||||||||||||||||||||||
| 550 | - | |||||||||||||||||||||||||||||||||||||
| 551 | if (m_textDirty
| 0 | ||||||||||||||||||||||||||||||||||||
| 552 | m_textDirty = false; | - | ||||||||||||||||||||||||||||||||||||
| 553 | QString actualText = text(); | - | ||||||||||||||||||||||||||||||||||||
| 554 | if (edited
| 0 | ||||||||||||||||||||||||||||||||||||
| 555 | textEdited(actualText); never executed: textEdited(actualText); | 0 | ||||||||||||||||||||||||||||||||||||
| 556 | textChanged(actualText); | - | ||||||||||||||||||||||||||||||||||||
| 557 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 558 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 559 | if (m_selDirty
| 0 | ||||||||||||||||||||||||||||||||||||
| 560 | m_selDirty = false; | - | ||||||||||||||||||||||||||||||||||||
| 561 | selectionChanged(); | - | ||||||||||||||||||||||||||||||||||||
| 562 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 563 | if (m_cursor == m_lastCursorPos
| 0 | ||||||||||||||||||||||||||||||||||||
| 564 | updateMicroFocus(); never executed: updateMicroFocus(); | 0 | ||||||||||||||||||||||||||||||||||||
| 565 | emitCursorPositionChanged(); | - | ||||||||||||||||||||||||||||||||||||
| 566 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 567 | } | - | ||||||||||||||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||||||||||||||
| 570 | - | |||||||||||||||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||||||||||||||
| 572 | - | |||||||||||||||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||||||||||||||
| 574 | void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edited) | - | ||||||||||||||||||||||||||||||||||||
| 575 | { | - | ||||||||||||||||||||||||||||||||||||
| 576 | cancelPasswordEchoTimer(); | - | ||||||||||||||||||||||||||||||||||||
| 577 | internalDeselect(); | - | ||||||||||||||||||||||||||||||||||||
| 578 | resetInputContext(); | - | ||||||||||||||||||||||||||||||||||||
| 579 | QString oldText = m_text; | - | ||||||||||||||||||||||||||||||||||||
| 580 | if (m_maskData
| 0 | ||||||||||||||||||||||||||||||||||||
| 581 | m_text = maskString(0, txt, true); | - | ||||||||||||||||||||||||||||||||||||
| 582 | m_text += clearString(m_text.length(), m_maxLength - m_text.length()); | - | ||||||||||||||||||||||||||||||||||||
| 583 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 584 | m_text = txt.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 585 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 586 | m_history.clear(); | - | ||||||||||||||||||||||||||||||||||||
| 587 | m_modifiedState = m_undoState = 0; | - | ||||||||||||||||||||||||||||||||||||
| 588 | m_cursor = (pos < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 589 | m_textDirty = (oldText != m_text); | - | ||||||||||||||||||||||||||||||||||||
| 590 | const bool changed = finishChange(-1, true, edited); | - | ||||||||||||||||||||||||||||||||||||
| 591 | - | |||||||||||||||||||||||||||||||||||||
| 592 | - | |||||||||||||||||||||||||||||||||||||
| 593 | if (changed
| 0 | ||||||||||||||||||||||||||||||||||||
| 594 | if (oldText.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 595 | QAccessibleTextInsertEvent event(accessibleObject(), 0, txt); | - | ||||||||||||||||||||||||||||||||||||
| 596 | event.setCursorPosition(m_cursor); | - | ||||||||||||||||||||||||||||||||||||
| 597 | QAccessible::updateAccessibility(&event); | - | ||||||||||||||||||||||||||||||||||||
| 598 | } never executed: else if (txt.isEmpty()end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 599 | QAccessibleTextRemoveEvent event(accessibleObject(), 0, oldText); | - | ||||||||||||||||||||||||||||||||||||
| 600 | event.setCursorPosition(m_cursor); | - | ||||||||||||||||||||||||||||||||||||
| 601 | QAccessible::updateAccessibility(&event); | - | ||||||||||||||||||||||||||||||||||||
| 602 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 603 | QAccessibleTextUpdateEvent event(accessibleObject(), 0, oldText, txt); | - | ||||||||||||||||||||||||||||||||||||
| 604 | event.setCursorPosition(m_cursor); | - | ||||||||||||||||||||||||||||||||||||
| 605 | QAccessible::updateAccessibility(&event); | - | ||||||||||||||||||||||||||||||||||||
| 606 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 607 | } | - | ||||||||||||||||||||||||||||||||||||
| 608 | - | |||||||||||||||||||||||||||||||||||||
| 609 | - | |||||||||||||||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||||||||||||||
| 611 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 612 | void QWidgetLineControl::addCommand(const Command &cmd) | - | ||||||||||||||||||||||||||||||||||||
| 613 | { | - | ||||||||||||||||||||||||||||||||||||
| 614 | m_history.erase(m_history.begin() + m_undoState, m_history.end()); | - | ||||||||||||||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||||||||||||||
| 616 | if (m_separator
| 0 | ||||||||||||||||||||||||||||||||||||
| 617 | m_history.push_back(Command(Separator, m_cursor, 0, m_selstart, m_selend)); never executed: m_history.push_back(Command(Separator, m_cursor, 0, m_selstart, m_selend)); | 0 | ||||||||||||||||||||||||||||||||||||
| 618 | - | |||||||||||||||||||||||||||||||||||||
| 619 | m_separator = false; | - | ||||||||||||||||||||||||||||||||||||
| 620 | m_history.push_back(cmd); | - | ||||||||||||||||||||||||||||||||||||
| 621 | m_undoState = int(m_history.size()); | - | ||||||||||||||||||||||||||||||||||||
| 622 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 623 | void QWidgetLineControl::internalInsert(const QString &s) | - | ||||||||||||||||||||||||||||||||||||
| 624 | { | - | ||||||||||||||||||||||||||||||||||||
| 625 | if (m_echoMode == QLineEdit::Password
| 0 | ||||||||||||||||||||||||||||||||||||
| 626 | if (m_passwordEchoTimer != 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 627 | killTimer(m_passwordEchoTimer); never executed: killTimer(m_passwordEchoTimer); | 0 | ||||||||||||||||||||||||||||||||||||
| 628 | int delay = m_passwordMaskDelay; | - | ||||||||||||||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||||||||||||||
| 630 | if (m_passwordMaskDelayOverride >= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 631 | delay = m_passwordMaskDelayOverride; never executed: delay = m_passwordMaskDelayOverride; | 0 | ||||||||||||||||||||||||||||||||||||
| 632 | - | |||||||||||||||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||||||||||||||
| 634 | if (delay > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 635 | m_passwordEchoTimer = startTimer(delay); never executed: m_passwordEchoTimer = startTimer(delay); | 0 | ||||||||||||||||||||||||||||||||||||
| 636 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 637 | if (hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 638 | addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); never executed: addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); | 0 | ||||||||||||||||||||||||||||||||||||
| 639 | if (m_maskData
| 0 | ||||||||||||||||||||||||||||||||||||
| 640 | QString ms = maskString(m_cursor, s); | - | ||||||||||||||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||||||||||||||
| 642 | QAccessibleTextInsertEvent insertEvent(accessibleObject(), m_cursor, ms); | - | ||||||||||||||||||||||||||||||||||||
| 643 | QAccessible::updateAccessibility(&insertEvent); | - | ||||||||||||||||||||||||||||||||||||
| 644 | - | |||||||||||||||||||||||||||||||||||||
| 645 | for (int i = 0; i < (int) ms.length()
| 0 | ||||||||||||||||||||||||||||||||||||
| 646 | addCommand (Command(DeleteSelection, m_cursor + i, m_text.at(m_cursor + i), -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 647 | addCommand(Command(Insert, m_cursor + i, ms.at(i), -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 648 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 649 | m_text.replace(m_cursor, ms.length(), ms); | - | ||||||||||||||||||||||||||||||||||||
| 650 | m_cursor += ms.length(); | - | ||||||||||||||||||||||||||||||||||||
| 651 | m_cursor = nextMaskBlank(m_cursor); | - | ||||||||||||||||||||||||||||||||||||
| 652 | m_textDirty = true; | - | ||||||||||||||||||||||||||||||||||||
| 653 | - | |||||||||||||||||||||||||||||||||||||
| 654 | QAccessibleTextCursorEvent event(accessibleObject(), m_cursor); | - | ||||||||||||||||||||||||||||||||||||
| 655 | QAccessible::updateAccessibility(&event); | - | ||||||||||||||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||||||||||||||
| 657 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 658 | int remaining = m_maxLength - m_text.length(); | - | ||||||||||||||||||||||||||||||||||||
| 659 | if (remaining != 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 660 | - | |||||||||||||||||||||||||||||||||||||
| 661 | QAccessibleTextInsertEvent insertEvent(accessibleObject(), m_cursor, s); | - | ||||||||||||||||||||||||||||||||||||
| 662 | QAccessible::updateAccessibility(&insertEvent); | - | ||||||||||||||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||||||||||||||
| 664 | m_text.insert(m_cursor, s.left(remaining)); | - | ||||||||||||||||||||||||||||||||||||
| 665 | for (int i = 0; i < (int) s.left(remaining).length()
| 0 | ||||||||||||||||||||||||||||||||||||
| 666 | addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1)); never executed: addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1)); | 0 | ||||||||||||||||||||||||||||||||||||
| 667 | m_textDirty = true; | - | ||||||||||||||||||||||||||||||||||||
| 668 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 669 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 670 | } | - | ||||||||||||||||||||||||||||||||||||
| 671 | void QWidgetLineControl::internalDelete(bool wasBackspace) | - | ||||||||||||||||||||||||||||||||||||
| 672 | { | - | ||||||||||||||||||||||||||||||||||||
| 673 | if (m_cursor < (int) m_text.length()
| 0 | ||||||||||||||||||||||||||||||||||||
| 674 | cancelPasswordEchoTimer(); | - | ||||||||||||||||||||||||||||||||||||
| 675 | if (hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 676 | addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); never executed: addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); | 0 | ||||||||||||||||||||||||||||||||||||
| 677 | addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)), | - | ||||||||||||||||||||||||||||||||||||
| 678 | m_cursor, m_text.at(m_cursor), -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 679 | - | |||||||||||||||||||||||||||||||||||||
| 680 | QAccessibleTextRemoveEvent event(accessibleObject(), m_cursor, m_text.at(m_cursor)); | - | ||||||||||||||||||||||||||||||||||||
| 681 | QAccessible::updateAccessibility(&event); | - | ||||||||||||||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||||||||||||||
| 683 | if (m_maskData
| 0 | ||||||||||||||||||||||||||||||||||||
| 684 | m_text.replace(m_cursor, 1, clearString(m_cursor, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 685 | addCommand(Command(Insert, m_cursor, m_text.at(m_cursor), -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 686 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 687 | m_text.remove(m_cursor, 1); | - | ||||||||||||||||||||||||||||||||||||
| 688 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 689 | m_textDirty = true; | - | ||||||||||||||||||||||||||||||||||||
| 690 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 691 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 692 | void QWidgetLineControl::removeSelectedText() | - | ||||||||||||||||||||||||||||||||||||
| 693 | { | - | ||||||||||||||||||||||||||||||||||||
| 694 | if (m_selstart < m_selend
| 0 | ||||||||||||||||||||||||||||||||||||
| 695 | cancelPasswordEchoTimer(); | - | ||||||||||||||||||||||||||||||||||||
| 696 | separate(); | - | ||||||||||||||||||||||||||||||||||||
| 697 | int i ; | - | ||||||||||||||||||||||||||||||||||||
| 698 | addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); | - | ||||||||||||||||||||||||||||||||||||
| 699 | if (m_selstart <= m_cursor
| 0 | ||||||||||||||||||||||||||||||||||||
| 700 | - | |||||||||||||||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||||||||||||||
| 702 | for (i = m_cursor; i >= m_selstart
| 0 | ||||||||||||||||||||||||||||||||||||
| 703 | addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1)); never executed: addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1)); | 0 | ||||||||||||||||||||||||||||||||||||
| 704 | for (i = m_selend - 1; i > m_cursor
| 0 | ||||||||||||||||||||||||||||||||||||
| 705 | addCommand (Command(DeleteSelection, i - m_cursor + m_selstart - 1, m_text.at(i), -1, -1)); never executed: addCommand (Command(DeleteSelection, i - m_cursor + m_selstart - 1, m_text.at(i), -1, -1)); | 0 | ||||||||||||||||||||||||||||||||||||
| 706 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 707 | for (i = m_selend-1; i >= m_selstart
| 0 | ||||||||||||||||||||||||||||||||||||
| 708 | addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1)); never executed: addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1)); | 0 | ||||||||||||||||||||||||||||||||||||
| 709 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 710 | - | |||||||||||||||||||||||||||||||||||||
| 711 | QAccessibleTextRemoveEvent event(accessibleObject(), m_selstart, m_text.mid(m_selstart, m_selend - m_selstart)); | - | ||||||||||||||||||||||||||||||||||||
| 712 | QAccessible::updateAccessibility(&event); | - | ||||||||||||||||||||||||||||||||||||
| 713 | - | |||||||||||||||||||||||||||||||||||||
| 714 | if (m_maskData
| 0 | ||||||||||||||||||||||||||||||||||||
| 715 | m_text.replace(m_selstart, m_selend - m_selstart, clearString(m_selstart, m_selend - m_selstart)); | - | ||||||||||||||||||||||||||||||||||||
| 716 | for (int i = 0; i < m_selend - m_selstart
| 0 | ||||||||||||||||||||||||||||||||||||
| 717 | addCommand(Command(Insert, m_selstart + i, m_text.at(m_selstart + i), -1, -1)); never executed: addCommand(Command(Insert, m_selstart + i, m_text.at(m_selstart + i), -1, -1)); | 0 | ||||||||||||||||||||||||||||||||||||
| 718 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 719 | m_text.remove(m_selstart, m_selend - m_selstart); | - | ||||||||||||||||||||||||||||||||||||
| 720 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 721 | if (m_cursor > m_selstart
| 0 | ||||||||||||||||||||||||||||||||||||
| 722 | m_cursor -= qMin(m_cursor, m_selend) - m_selstart; never executed: m_cursor -= qMin(m_cursor, m_selend) - m_selstart; | 0 | ||||||||||||||||||||||||||||||||||||
| 723 | internalDeselect(); | - | ||||||||||||||||||||||||||||||||||||
| 724 | m_textDirty = true; | - | ||||||||||||||||||||||||||||||||||||
| 725 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 726 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||||||||||||||
| 728 | - | |||||||||||||||||||||||||||||||||||||
| 729 | - | |||||||||||||||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||||||||||||||
| 733 | - | |||||||||||||||||||||||||||||||||||||
| 734 | void QWidgetLineControl::parseInputMask(const QString &maskFields) | - | ||||||||||||||||||||||||||||||||||||
| 735 | { | - | ||||||||||||||||||||||||||||||||||||
| 736 | int delimiter = maskFields.indexOf(QLatin1Char(';')); | - | ||||||||||||||||||||||||||||||||||||
| 737 | if (maskFields.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 738 | if (m_maskData
| 0 | ||||||||||||||||||||||||||||||||||||
| 739 | delete [] m_maskData; | - | ||||||||||||||||||||||||||||||||||||
| 740 | m_maskData = 0; | - | ||||||||||||||||||||||||||||||||||||
| 741 | m_maxLength = 32767; | - | ||||||||||||||||||||||||||||||||||||
| 742 | internalSetText(QString(), -1, false); | - | ||||||||||||||||||||||||||||||||||||
| 743 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 744 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 745 | } | - | ||||||||||||||||||||||||||||||||||||
| 746 | - | |||||||||||||||||||||||||||||||||||||
| 747 | if (delimiter == -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 748 | m_blank = QLatin1Char(' '); | - | ||||||||||||||||||||||||||||||||||||
| 749 | m_inputMask = maskFields; | - | ||||||||||||||||||||||||||||||||||||
| 750 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 751 | m_inputMask = maskFields.left(delimiter); | - | ||||||||||||||||||||||||||||||||||||
| 752 | m_blank = (
| 0 | ||||||||||||||||||||||||||||||||||||
| 753 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||||||||||||||
| 756 | m_maxLength = 0; | - | ||||||||||||||||||||||||||||||||||||
| 757 | QChar c = 0; | - | ||||||||||||||||||||||||||||||||||||
| 758 | for (int i=0; i<m_inputMask.length()
| 0 | ||||||||||||||||||||||||||||||||||||
| 759 | c = m_inputMask.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 760 | if (i > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 761 | m_maxLength++; | - | ||||||||||||||||||||||||||||||||||||
| 762 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||
| 763 | } | - | ||||||||||||||||||||||||||||||||||||
| 764 | if (c != QLatin1Char('\\')
| 0 | ||||||||||||||||||||||||||||||||||||
| 765 | c != QLatin1Char('<')
| 0 | ||||||||||||||||||||||||||||||||||||
| 766 | c != QLatin1Char('{')
| 0 | ||||||||||||||||||||||||||||||||||||
| 767 | c != QLatin1Char('[')
| 0 | ||||||||||||||||||||||||||||||||||||
| 768 | m_maxLength++; never executed: m_maxLength++; | 0 | ||||||||||||||||||||||||||||||||||||
| 769 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 770 | - | |||||||||||||||||||||||||||||||||||||
| 771 | delete [] m_maskData; | - | ||||||||||||||||||||||||||||||||||||
| 772 | m_maskData = new MaskInputData[m_maxLength]; | - | ||||||||||||||||||||||||||||||||||||
| 773 | - | |||||||||||||||||||||||||||||||||||||
| 774 | MaskInputData::Casemode m = MaskInputData::NoCaseMode; | - | ||||||||||||||||||||||||||||||||||||
| 775 | c = 0; | - | ||||||||||||||||||||||||||||||||||||
| 776 | bool s; | - | ||||||||||||||||||||||||||||||||||||
| 777 | bool escape = false; | - | ||||||||||||||||||||||||||||||||||||
| 778 | int index = 0; | - | ||||||||||||||||||||||||||||||||||||
| 779 | for (int i = 0; i < m_inputMask.length()
| 0 | ||||||||||||||||||||||||||||||||||||
| 780 | c = m_inputMask.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 781 | if (escape
| 0 | ||||||||||||||||||||||||||||||||||||
| 782 | s = true; | - | ||||||||||||||||||||||||||||||||||||
| 783 | m_maskData[index].maskChar = c; | - | ||||||||||||||||||||||||||||||||||||
| 784 | m_maskData[index].separator = s; | - | ||||||||||||||||||||||||||||||||||||
| 785 | m_maskData[index].caseMode = m; | - | ||||||||||||||||||||||||||||||||||||
| 786 | index++; | - | ||||||||||||||||||||||||||||||||||||
| 787 | escape = false; | - | ||||||||||||||||||||||||||||||||||||
| 788 | } never executed: else if (c == QLatin1Char('<')end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 789 | m = MaskInputData::Lower; | - | ||||||||||||||||||||||||||||||||||||
| 790 | } never executed: else if (c == QLatin1Char('>')end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 791 | m = MaskInputData::Upper; | - | ||||||||||||||||||||||||||||||||||||
| 792 | } never executed: else if (c == QLatin1Char('!')end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 793 | m = MaskInputData::NoCaseMode; | - | ||||||||||||||||||||||||||||||||||||
| 794 | } never executed: else if (c != QLatin1Char('{')end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 795 | switch (c.unicode()) { | - | ||||||||||||||||||||||||||||||||||||
| 796 | case never executed: 'A':case 'A':never executed: case 'A': | 0 | ||||||||||||||||||||||||||||||||||||
| 797 | case never executed: 'a':case 'a':never executed: case 'a': | 0 | ||||||||||||||||||||||||||||||||||||
| 798 | case never executed: 'N':case 'N':never executed: case 'N': | 0 | ||||||||||||||||||||||||||||||||||||
| 799 | case never executed: 'n':case 'n':never executed: case 'n': | 0 | ||||||||||||||||||||||||||||||||||||
| 800 | case never executed: 'X':case 'X':never executed: case 'X': | 0 | ||||||||||||||||||||||||||||||||||||
| 801 | case never executed: 'x':case 'x':never executed: case 'x': | 0 | ||||||||||||||||||||||||||||||||||||
| 802 | case never executed: '9':case '9':never executed: case '9': | 0 | ||||||||||||||||||||||||||||||||||||
| 803 | case never executed: '0':case '0':never executed: case '0': | 0 | ||||||||||||||||||||||||||||||||||||
| 804 | case never executed: 'D':case 'D':never executed: case 'D': | 0 | ||||||||||||||||||||||||||||||||||||
| 805 | case never executed: 'd':case 'd':never executed: case 'd': | 0 | ||||||||||||||||||||||||||||||||||||
| 806 | case never executed: '#':case '#':never executed: case '#': | 0 | ||||||||||||||||||||||||||||||||||||
| 807 | case never executed: 'H':case 'H':never executed: case 'H': | 0 | ||||||||||||||||||||||||||||||||||||
| 808 | case never executed: 'h':case 'h':never executed: case 'h': | 0 | ||||||||||||||||||||||||||||||||||||
| 809 | case never executed: 'B':case 'B':never executed: case 'B': | 0 | ||||||||||||||||||||||||||||||||||||
| 810 | case never executed: 'b':case 'b':never executed: case 'b': | 0 | ||||||||||||||||||||||||||||||||||||
| 811 | s = false; | - | ||||||||||||||||||||||||||||||||||||
| 812 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 813 | case never executed: '\\':case '\\':never executed: case '\\': | 0 | ||||||||||||||||||||||||||||||||||||
| 814 | escape = true; | - | ||||||||||||||||||||||||||||||||||||
| 815 | default never executed: :default:never executed: default:code before this statement never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 816 | s = true; | - | ||||||||||||||||||||||||||||||||||||
| 817 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 818 | } | - | ||||||||||||||||||||||||||||||||||||
| 819 | - | |||||||||||||||||||||||||||||||||||||
| 820 | if (!escape
| 0 | ||||||||||||||||||||||||||||||||||||
| 821 | m_maskData[index].maskChar = c; | - | ||||||||||||||||||||||||||||||||||||
| 822 | m_maskData[index].separator = s; | - | ||||||||||||||||||||||||||||||||||||
| 823 | m_maskData[index].caseMode = m; | - | ||||||||||||||||||||||||||||||||||||
| 824 | index++; | - | ||||||||||||||||||||||||||||||||||||
| 825 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 826 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 827 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 828 | internalSetText(m_text, -1, false); | - | ||||||||||||||||||||||||||||||||||||
| 829 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 830 | - | |||||||||||||||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||||||||||||||
| 832 | - | |||||||||||||||||||||||||||||||||||||
| 833 | - | |||||||||||||||||||||||||||||||||||||
| 834 | - | |||||||||||||||||||||||||||||||||||||
| 835 | - | |||||||||||||||||||||||||||||||||||||
| 836 | - | |||||||||||||||||||||||||||||||||||||
| 837 | bool QWidgetLineControl::isValidInput(QChar key, QChar mask) const | - | ||||||||||||||||||||||||||||||||||||
| 838 | { | - | ||||||||||||||||||||||||||||||||||||
| 839 | switch (mask.unicode()) { | - | ||||||||||||||||||||||||||||||||||||
| 840 | case never executed: 'A':case 'A':never executed: case 'A': | 0 | ||||||||||||||||||||||||||||||||||||
| 841 | if (key.isLetter()
| 0 | ||||||||||||||||||||||||||||||||||||
| 842 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 843 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 844 | case never executed: 'a':case 'a':never executed: case 'a': | 0 | ||||||||||||||||||||||||||||||||||||
| 845 | if (key.isLetter()
| 0 | ||||||||||||||||||||||||||||||||||||
| 846 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 847 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 848 | case never executed: 'N':case 'N':never executed: case 'N': | 0 | ||||||||||||||||||||||||||||||||||||
| 849 | if (key.isLetterOrNumber()
| 0 | ||||||||||||||||||||||||||||||||||||
| 850 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 851 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 852 | case never executed: 'n':case 'n':never executed: case 'n': | 0 | ||||||||||||||||||||||||||||||||||||
| 853 | if (key.isLetterOrNumber()
| 0 | ||||||||||||||||||||||||||||||||||||
| 854 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 855 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 856 | case never executed: 'X':case 'X':never executed: case 'X': | 0 | ||||||||||||||||||||||||||||||||||||
| 857 | if (key.isPrint()
| 0 | ||||||||||||||||||||||||||||||||||||
| 858 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 859 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 860 | case never executed: 'x':case 'x':never executed: case 'x': | 0 | ||||||||||||||||||||||||||||||||||||
| 861 | if (key.isPrint()
| 0 | ||||||||||||||||||||||||||||||||||||
| 862 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 863 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 864 | case never executed: '9':case '9':never executed: case '9': | 0 | ||||||||||||||||||||||||||||||||||||
| 865 | if (key.isNumber()
| 0 | ||||||||||||||||||||||||||||||||||||
| 866 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 867 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 868 | case never executed: '0':case '0':never executed: case '0': | 0 | ||||||||||||||||||||||||||||||||||||
| 869 | if (key.isNumber()
| 0 | ||||||||||||||||||||||||||||||||||||
| 870 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 871 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 872 | case never executed: 'D':case 'D':never executed: case 'D': | 0 | ||||||||||||||||||||||||||||||||||||
| 873 | if (key.isNumber()
| 0 | ||||||||||||||||||||||||||||||||||||
| 874 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 875 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 876 | case never executed: 'd':case 'd':never executed: case 'd': | 0 | ||||||||||||||||||||||||||||||||||||
| 877 | if ((key.isNumber()
| 0 | ||||||||||||||||||||||||||||||||||||
| 878 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 879 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 880 | case never executed: '#':case '#':never executed: case '#': | 0 | ||||||||||||||||||||||||||||||||||||
| 881 | if (key.isNumber()
| 0 | ||||||||||||||||||||||||||||||||||||
| 882 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 883 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 884 | case never executed: 'B':case 'B':never executed: case 'B': | 0 | ||||||||||||||||||||||||||||||||||||
| 885 | if (key == QLatin1Char('0')
| 0 | ||||||||||||||||||||||||||||||||||||
| 886 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 887 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 888 | case never executed: 'b':case 'b':never executed: case 'b': | 0 | ||||||||||||||||||||||||||||||||||||
| 889 | if (key == QLatin1Char('0')
| 0 | ||||||||||||||||||||||||||||||||||||
| 890 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 891 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 892 | case never executed: 'H':case 'H':never executed: case 'H': | 0 | ||||||||||||||||||||||||||||||||||||
| 893 | if (key.isNumber()
| 0 | ||||||||||||||||||||||||||||||||||||
| 894 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 895 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 896 | case never executed: 'h':case 'h':never executed: case 'h': | 0 | ||||||||||||||||||||||||||||||||||||
| 897 | if (key.isNumber()
| 0 | ||||||||||||||||||||||||||||||||||||
| 898 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 899 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 900 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 901 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 902 | } | - | ||||||||||||||||||||||||||||||||||||
| 903 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 904 | } | - | ||||||||||||||||||||||||||||||||||||
| 905 | bool QWidgetLineControl::hasAcceptableInput(const QString &str) const | - | ||||||||||||||||||||||||||||||||||||
| 906 | { | - | ||||||||||||||||||||||||||||||||||||
| 907 | - | |||||||||||||||||||||||||||||||||||||
| 908 | QString textCopy = str; | - | ||||||||||||||||||||||||||||||||||||
| 909 | int cursorCopy = m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 910 | if (m_validator
| 0 | ||||||||||||||||||||||||||||||||||||
| 911 | != QValidator::Acceptable
| 0 | ||||||||||||||||||||||||||||||||||||
| 912 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 913 | - | |||||||||||||||||||||||||||||||||||||
| 914 | - | |||||||||||||||||||||||||||||||||||||
| 915 | if (!m_maskData
| 0 | ||||||||||||||||||||||||||||||||||||
| 916 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 917 | - | |||||||||||||||||||||||||||||||||||||
| 918 | if (str.length() != m_maxLength
| 0 | ||||||||||||||||||||||||||||||||||||
| 919 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 920 | - | |||||||||||||||||||||||||||||||||||||
| 921 | for (int i=0; i < m_maxLength
| 0 | ||||||||||||||||||||||||||||||||||||
| 922 | if (m_maskData[i].separator
| 0 | ||||||||||||||||||||||||||||||||||||
| 923 | if (str.at(i) != m_maskData[i].maskChar
| 0 | ||||||||||||||||||||||||||||||||||||
| 924 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 925 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 926 | if (!isValidInput(str.at(i), m_maskData[i].maskChar)
| 0 | ||||||||||||||||||||||||||||||||||||
| 927 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 928 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 929 | } | - | ||||||||||||||||||||||||||||||||||||
| 930 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 931 | } | - | ||||||||||||||||||||||||||||||||||||
| 932 | QString QWidgetLineControl::maskString(uint pos, const QString &str, bool clear) const | - | ||||||||||||||||||||||||||||||||||||
| 933 | { | - | ||||||||||||||||||||||||||||||||||||
| 934 | if (pos >= (uint)m_maxLength
| 0 | ||||||||||||||||||||||||||||||||||||
| 935 | return never executed: QString::fromLatin1("");return QString::fromLatin1("");never executed: return QString::fromLatin1(""); | 0 | ||||||||||||||||||||||||||||||||||||
| 936 | - | |||||||||||||||||||||||||||||||||||||
| 937 | QString fill; | - | ||||||||||||||||||||||||||||||||||||
| 938 | fill = clear
| 0 | ||||||||||||||||||||||||||||||||||||
| 939 | - | |||||||||||||||||||||||||||||||||||||
| 940 | int strIndex = 0; | - | ||||||||||||||||||||||||||||||||||||
| 941 | QString s = QString::fromLatin1(""); | - | ||||||||||||||||||||||||||||||||||||
| 942 | int i = pos; | - | ||||||||||||||||||||||||||||||||||||
| 943 | while (i < m_maxLength
| 0 | ||||||||||||||||||||||||||||||||||||
| 944 | if (strIndex < str.length()
| 0 | ||||||||||||||||||||||||||||||||||||
| 945 | if (m_maskData[i].separator
| 0 | ||||||||||||||||||||||||||||||||||||
| 946 | s += m_maskData[i].maskChar; | - | ||||||||||||||||||||||||||||||||||||
| 947 | if (str[(int)strIndex] == m_maskData[i].maskChar
| 0 | ||||||||||||||||||||||||||||||||||||
| 948 | strIndex++; never executed: strIndex++; | 0 | ||||||||||||||||||||||||||||||||||||
| 949 | ++i; | - | ||||||||||||||||||||||||||||||||||||
| 950 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 951 | if (isValidInput(str[(int)strIndex], m_maskData[i].maskChar)
| 0 | ||||||||||||||||||||||||||||||||||||
| 952 | switch (m_maskData[i].caseMode) { | - | ||||||||||||||||||||||||||||||||||||
| 953 | case never executed: MaskInputData::Upper:case MaskInputData::Upper:never executed: case MaskInputData::Upper: | 0 | ||||||||||||||||||||||||||||||||||||
| 954 | s += str[(int)strIndex].toUpper(); | - | ||||||||||||||||||||||||||||||||||||
| 955 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 956 | case never executed: MaskInputData::Lower:case MaskInputData::Lower:never executed: case MaskInputData::Lower: | 0 | ||||||||||||||||||||||||||||||||||||
| 957 | s += str[(int)strIndex].toLower(); | - | ||||||||||||||||||||||||||||||||||||
| 958 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 959 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 960 | s += str[(int)strIndex]; | - | ||||||||||||||||||||||||||||||||||||
| 961 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 962 | ++i; | - | ||||||||||||||||||||||||||||||||||||
| 963 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 964 | - | |||||||||||||||||||||||||||||||||||||
| 965 | int n = findInMask(i, true, true, str[(int)strIndex]); | - | ||||||||||||||||||||||||||||||||||||
| 966 | if (n != -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 967 | if (str.length() != 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 968 | s += fill.midRef(i, n - i + 1); | - | ||||||||||||||||||||||||||||||||||||
| 969 | i = n + 1; | - | ||||||||||||||||||||||||||||||||||||
| 970 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 971 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 972 | - | |||||||||||||||||||||||||||||||||||||
| 973 | n = findInMask(i, true, false, str[(int)strIndex]); | - | ||||||||||||||||||||||||||||||||||||
| 974 | if (n != -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 975 | s += fill.midRef(i, n - i); | - | ||||||||||||||||||||||||||||||||||||
| 976 | switch (m_maskData[n].caseMode) { | - | ||||||||||||||||||||||||||||||||||||
| 977 | case never executed: MaskInputData::Upper:case MaskInputData::Upper:never executed: case MaskInputData::Upper: | 0 | ||||||||||||||||||||||||||||||||||||
| 978 | s += str[(int)strIndex].toUpper(); | - | ||||||||||||||||||||||||||||||||||||
| 979 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 980 | case never executed: MaskInputData::Lower:case MaskInputData::Lower:never executed: case MaskInputData::Lower: | 0 | ||||||||||||||||||||||||||||||||||||
| 981 | s += str[(int)strIndex].toLower(); | - | ||||||||||||||||||||||||||||||||||||
| 982 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 983 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 984 | s += str[(int)strIndex]; | - | ||||||||||||||||||||||||||||||||||||
| 985 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 986 | i = n + 1; | - | ||||||||||||||||||||||||||||||||||||
| 987 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 988 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 989 | } | - | ||||||||||||||||||||||||||||||||||||
| 990 | ++strIndex; | - | ||||||||||||||||||||||||||||||||||||
| 991 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 992 | } else | - | ||||||||||||||||||||||||||||||||||||
| 993 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 994 | } | - | ||||||||||||||||||||||||||||||||||||
| 995 | - | |||||||||||||||||||||||||||||||||||||
| 996 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||||||||||||||
| 997 | } | - | ||||||||||||||||||||||||||||||||||||
| 998 | QString QWidgetLineControl::clearString(uint pos, uint len) const | - | ||||||||||||||||||||||||||||||||||||
| 999 | { | - | ||||||||||||||||||||||||||||||||||||
| 1000 | if (pos >= (uint)m_maxLength
| 0 | ||||||||||||||||||||||||||||||||||||
| 1001 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1002 | - | |||||||||||||||||||||||||||||||||||||
| 1003 | QString s; | - | ||||||||||||||||||||||||||||||||||||
| 1004 | int end = qMin((uint)m_maxLength, pos + len); | - | ||||||||||||||||||||||||||||||||||||
| 1005 | for (int i = pos; i < end
| 0 | ||||||||||||||||||||||||||||||||||||
| 1006 | if (m_maskData[i].separator
| 0 | ||||||||||||||||||||||||||||||||||||
| 1007 | s += m_maskData[i].maskChar; never executed: s += m_maskData[i].maskChar; | 0 | ||||||||||||||||||||||||||||||||||||
| 1008 | else | - | ||||||||||||||||||||||||||||||||||||
| 1009 | s += m_blank; never executed: s += m_blank; | 0 | ||||||||||||||||||||||||||||||||||||
| 1010 | - | |||||||||||||||||||||||||||||||||||||
| 1011 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||||||||||||||
| 1012 | } | - | ||||||||||||||||||||||||||||||||||||
| 1013 | - | |||||||||||||||||||||||||||||||||||||
| 1014 | - | |||||||||||||||||||||||||||||||||||||
| 1015 | - | |||||||||||||||||||||||||||||||||||||
| 1016 | - | |||||||||||||||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||||||||||||||
| 1018 | - | |||||||||||||||||||||||||||||||||||||
| 1019 | - | |||||||||||||||||||||||||||||||||||||
| 1020 | QString QWidgetLineControl::stripString(const QString &str) const | - | ||||||||||||||||||||||||||||||||||||
| 1021 | { | - | ||||||||||||||||||||||||||||||||||||
| 1022 | if (!m_maskData
| 0 | ||||||||||||||||||||||||||||||||||||
| 1023 | return never executed: str;return str;never executed: return str; | 0 | ||||||||||||||||||||||||||||||||||||
| 1024 | - | |||||||||||||||||||||||||||||||||||||
| 1025 | QString s; | - | ||||||||||||||||||||||||||||||||||||
| 1026 | int end = qMin(m_maxLength, (int)str.length()); | - | ||||||||||||||||||||||||||||||||||||
| 1027 | for (int i = 0; i < end
| 0 | ||||||||||||||||||||||||||||||||||||
| 1028 | if (m_maskData[i].separator
| 0 | ||||||||||||||||||||||||||||||||||||
| 1029 | s += m_maskData[i].maskChar; never executed: s += m_maskData[i].maskChar; | 0 | ||||||||||||||||||||||||||||||||||||
| 1030 | else | - | ||||||||||||||||||||||||||||||||||||
| 1031 | if (str[i] != m_blank
| 0 | ||||||||||||||||||||||||||||||||||||
| 1032 | s += str[i]; never executed: s += str[i]; | 0 | ||||||||||||||||||||||||||||||||||||
| 1033 | - | |||||||||||||||||||||||||||||||||||||
| 1034 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||||||||||||||
| 1035 | } | - | ||||||||||||||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||||||||||||||
| 1038 | - | |||||||||||||||||||||||||||||||||||||
| 1039 | - | |||||||||||||||||||||||||||||||||||||
| 1040 | - | |||||||||||||||||||||||||||||||||||||
| 1041 | int QWidgetLineControl::findInMask(int pos, bool forward, bool findSeparator, QChar searchChar) const | - | ||||||||||||||||||||||||||||||||||||
| 1042 | { | - | ||||||||||||||||||||||||||||||||||||
| 1043 | if (pos >= m_maxLength
| 0 | ||||||||||||||||||||||||||||||||||||
| 1044 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1045 | - | |||||||||||||||||||||||||||||||||||||
| 1046 | int end = forward
| 0 | ||||||||||||||||||||||||||||||||||||
| 1047 | int step = forward
| 0 | ||||||||||||||||||||||||||||||||||||
| 1048 | int i = pos; | - | ||||||||||||||||||||||||||||||||||||
| 1049 | - | |||||||||||||||||||||||||||||||||||||
| 1050 | while (i != end
| 0 | ||||||||||||||||||||||||||||||||||||
| 1051 | if (findSeparator
| 0 | ||||||||||||||||||||||||||||||||||||
| 1052 | if (m_maskData[i].separator
| 0 | ||||||||||||||||||||||||||||||||||||
| 1053 | return never executed: i;return i;never executed: return i; | 0 | ||||||||||||||||||||||||||||||||||||
| 1054 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1055 | if (!m_maskData[i].separator
| 0 | ||||||||||||||||||||||||||||||||||||
| 1056 | if (searchChar.isNull()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1057 | return never executed: i;return i;never executed: return i; | 0 | ||||||||||||||||||||||||||||||||||||
| 1058 | else if (isValidInput(searchChar, m_maskData[i].maskChar)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1059 | return never executed: i;return i;never executed: return i; | 0 | ||||||||||||||||||||||||||||||||||||
| 1060 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1061 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1062 | i += step; | - | ||||||||||||||||||||||||||||||||||||
| 1063 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1064 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1065 | } | - | ||||||||||||||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||||||||||||||
| 1067 | void QWidgetLineControl::internalUndo(int until) | - | ||||||||||||||||||||||||||||||||||||
| 1068 | { | - | ||||||||||||||||||||||||||||||||||||
| 1069 | if (!isUndoAvailable()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1070 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1071 | cancelPasswordEchoTimer(); | - | ||||||||||||||||||||||||||||||||||||
| 1072 | internalDeselect(); | - | ||||||||||||||||||||||||||||||||||||
| 1073 | - | |||||||||||||||||||||||||||||||||||||
| 1074 | while (m_undoState
| 0 | ||||||||||||||||||||||||||||||||||||
| 1075 | Command& cmd = m_history[--m_undoState]; | - | ||||||||||||||||||||||||||||||||||||
| 1076 | switch (cmd.type) { | - | ||||||||||||||||||||||||||||||||||||
| 1077 | case never executed: Insert:case Insert:never executed: case Insert: | 0 | ||||||||||||||||||||||||||||||||||||
| 1078 | m_text.remove(cmd.pos, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1079 | m_cursor = cmd.pos; | - | ||||||||||||||||||||||||||||||||||||
| 1080 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1081 | case never executed: SetSelection:case SetSelection:never executed: case SetSelection: | 0 | ||||||||||||||||||||||||||||||||||||
| 1082 | m_selstart = cmd.selStart; | - | ||||||||||||||||||||||||||||||||||||
| 1083 | m_selend = cmd.selEnd; | - | ||||||||||||||||||||||||||||||||||||
| 1084 | m_cursor = cmd.pos; | - | ||||||||||||||||||||||||||||||||||||
| 1085 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1086 | case never executed: Remove:case Remove:never executed: case Remove: | 0 | ||||||||||||||||||||||||||||||||||||
| 1087 | case never executed: RemoveSelection:case RemoveSelection:never executed: case RemoveSelection: | 0 | ||||||||||||||||||||||||||||||||||||
| 1088 | m_text.insert(cmd.pos, cmd.uc); | - | ||||||||||||||||||||||||||||||||||||
| 1089 | m_cursor = cmd.pos + 1; | - | ||||||||||||||||||||||||||||||||||||
| 1090 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1091 | case never executed: Delete:case Delete:never executed: case Delete: | 0 | ||||||||||||||||||||||||||||||||||||
| 1092 | case never executed: DeleteSelection:case DeleteSelection:never executed: case DeleteSelection: | 0 | ||||||||||||||||||||||||||||||||||||
| 1093 | m_text.insert(cmd.pos, cmd.uc); | - | ||||||||||||||||||||||||||||||||||||
| 1094 | m_cursor = cmd.pos; | - | ||||||||||||||||||||||||||||||||||||
| 1095 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1096 | case never executed: Separator:case Separator:never executed: case Separator: | 0 | ||||||||||||||||||||||||||||||||||||
| 1097 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||
| 1098 | } | - | ||||||||||||||||||||||||||||||||||||
| 1099 | if (until < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1100 | Command& next = m_history[m_undoState-1]; | - | ||||||||||||||||||||||||||||||||||||
| 1101 | if (next.type != cmd.type
| 0 | ||||||||||||||||||||||||||||||||||||
| 1102 | && (cmd.type < RemoveSelection
| 0 | ||||||||||||||||||||||||||||||||||||
| 1103 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1104 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1105 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1106 | m_textDirty = true; | - | ||||||||||||||||||||||||||||||||||||
| 1107 | emitCursorPositionChanged(); | - | ||||||||||||||||||||||||||||||||||||
| 1108 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1109 | - | |||||||||||||||||||||||||||||||||||||
| 1110 | void QWidgetLineControl::internalRedo() | - | ||||||||||||||||||||||||||||||||||||
| 1111 | { | - | ||||||||||||||||||||||||||||||||||||
| 1112 | if (!isRedoAvailable()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1113 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1114 | internalDeselect(); | - | ||||||||||||||||||||||||||||||||||||
| 1115 | while (m_undoState < (int)m_history.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1116 | Command& cmd = m_history[m_undoState++]; | - | ||||||||||||||||||||||||||||||||||||
| 1117 | switch (cmd.type) { | - | ||||||||||||||||||||||||||||||||||||
| 1118 | case never executed: Insert:case Insert:never executed: case Insert: | 0 | ||||||||||||||||||||||||||||||||||||
| 1119 | m_text.insert(cmd.pos, cmd.uc); | - | ||||||||||||||||||||||||||||||||||||
| 1120 | m_cursor = cmd.pos + 1; | - | ||||||||||||||||||||||||||||||||||||
| 1121 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1122 | case never executed: SetSelection:case SetSelection:never executed: case SetSelection: | 0 | ||||||||||||||||||||||||||||||||||||
| 1123 | m_selstart = cmd.selStart; | - | ||||||||||||||||||||||||||||||||||||
| 1124 | m_selend = cmd.selEnd; | - | ||||||||||||||||||||||||||||||||||||
| 1125 | m_cursor = cmd.pos; | - | ||||||||||||||||||||||||||||||||||||
| 1126 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1127 | case never executed: Remove:case Remove:never executed: case Remove: | 0 | ||||||||||||||||||||||||||||||||||||
| 1128 | case never executed: Delete:case Delete:never executed: case Delete: | 0 | ||||||||||||||||||||||||||||||||||||
| 1129 | case never executed: RemoveSelection:case RemoveSelection:never executed: case RemoveSelection: | 0 | ||||||||||||||||||||||||||||||||||||
| 1130 | case never executed: DeleteSelection:case DeleteSelection:never executed: case DeleteSelection: | 0 | ||||||||||||||||||||||||||||||||||||
| 1131 | m_text.remove(cmd.pos, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1132 | m_selstart = cmd.selStart; | - | ||||||||||||||||||||||||||||||||||||
| 1133 | m_selend = cmd.selEnd; | - | ||||||||||||||||||||||||||||||||||||
| 1134 | m_cursor = cmd.pos; | - | ||||||||||||||||||||||||||||||||||||
| 1135 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1136 | case never executed: Separator:case Separator:never executed: case Separator: | 0 | ||||||||||||||||||||||||||||||||||||
| 1137 | m_selstart = cmd.selStart; | - | ||||||||||||||||||||||||||||||||||||
| 1138 | m_selend = cmd.selEnd; | - | ||||||||||||||||||||||||||||||||||||
| 1139 | m_cursor = cmd.pos; | - | ||||||||||||||||||||||||||||||||||||
| 1140 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1141 | } | - | ||||||||||||||||||||||||||||||||||||
| 1142 | if (m_undoState < (int)m_history.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1143 | Command& next = m_history[m_undoState]; | - | ||||||||||||||||||||||||||||||||||||
| 1144 | if (next.type != cmd.type
| 0 | ||||||||||||||||||||||||||||||||||||
| 1145 | && (next.type < RemoveSelection
| 0 | ||||||||||||||||||||||||||||||||||||
| 1146 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1147 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1148 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1149 | m_textDirty = true; | - | ||||||||||||||||||||||||||||||||||||
| 1150 | emitCursorPositionChanged(); | - | ||||||||||||||||||||||||||||||||||||
| 1151 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1152 | - | |||||||||||||||||||||||||||||||||||||
| 1153 | - | |||||||||||||||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||||||||||||||
| 1155 | - | |||||||||||||||||||||||||||||||||||||
| 1156 | - | |||||||||||||||||||||||||||||||||||||
| 1157 | - | |||||||||||||||||||||||||||||||||||||
| 1158 | - | |||||||||||||||||||||||||||||||||||||
| 1159 | void QWidgetLineControl::emitCursorPositionChanged() | - | ||||||||||||||||||||||||||||||||||||
| 1160 | { | - | ||||||||||||||||||||||||||||||||||||
| 1161 | if (m_cursor != m_lastCursorPos
| 0 | ||||||||||||||||||||||||||||||||||||
| 1162 | const int oldLast = m_lastCursorPos; | - | ||||||||||||||||||||||||||||||||||||
| 1163 | m_lastCursorPos = m_cursor; | - | ||||||||||||||||||||||||||||||||||||
| 1164 | cursorPositionChanged(oldLast, m_cursor); | - | ||||||||||||||||||||||||||||||||||||
| 1165 | - | |||||||||||||||||||||||||||||||||||||
| 1166 | - | |||||||||||||||||||||||||||||||||||||
| 1167 | if (!hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1168 | QAccessibleTextCursorEvent event(accessibleObject(), m_cursor); | - | ||||||||||||||||||||||||||||||||||||
| 1169 | QAccessible::updateAccessibility(&event); | - | ||||||||||||||||||||||||||||||||||||
| 1170 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1171 | - | |||||||||||||||||||||||||||||||||||||
| 1172 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1173 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1174 | - | |||||||||||||||||||||||||||||||||||||
| 1175 | - | |||||||||||||||||||||||||||||||||||||
| 1176 | - | |||||||||||||||||||||||||||||||||||||
| 1177 | - | |||||||||||||||||||||||||||||||||||||
| 1178 | bool QWidgetLineControl::advanceToEnabledItem(int dir) | - | ||||||||||||||||||||||||||||||||||||
| 1179 | { | - | ||||||||||||||||||||||||||||||||||||
| 1180 | int start = m_completer->currentRow(); | - | ||||||||||||||||||||||||||||||||||||
| 1181 | if (start == -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1182 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1183 | int i = start + dir; | - | ||||||||||||||||||||||||||||||||||||
| 1184 | if (dir == 0
never executed: dir = 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1185 | do { | - | ||||||||||||||||||||||||||||||||||||
| 1186 | if (!m_completer->setCurrentRow(i)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1187 | if (!m_completer->wrapAround()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1188 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1189 | i = i > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1190 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1191 | QModelIndex currentIndex = m_completer->currentIndex(); | - | ||||||||||||||||||||||||||||||||||||
| 1192 | if (m_completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled
| 0 | ||||||||||||||||||||||||||||||||||||
| 1193 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1194 | i += dir; | - | ||||||||||||||||||||||||||||||||||||
| 1195 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1196 | } while (i != start
| 0 | ||||||||||||||||||||||||||||||||||||
| 1197 | - | |||||||||||||||||||||||||||||||||||||
| 1198 | m_completer->setCurrentRow(start); | - | ||||||||||||||||||||||||||||||||||||
| 1199 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1200 | } | - | ||||||||||||||||||||||||||||||||||||
| 1201 | - | |||||||||||||||||||||||||||||||||||||
| 1202 | void QWidgetLineControl::complete(int key) | - | ||||||||||||||||||||||||||||||||||||
| 1203 | { | - | ||||||||||||||||||||||||||||||||||||
| 1204 | if (!m_completer
| 0 | ||||||||||||||||||||||||||||||||||||
| 1205 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1206 | - | |||||||||||||||||||||||||||||||||||||
| 1207 | QString text = this->text(); | - | ||||||||||||||||||||||||||||||||||||
| 1208 | if (m_completer->completionMode() == QCompleter::InlineCompletion
| 0 | ||||||||||||||||||||||||||||||||||||
| 1209 | if (key == Qt::Key_Backspace
| 0 | ||||||||||||||||||||||||||||||||||||
| 1210 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1211 | int n = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1212 | if (key == Qt::Key_Up
| 0 | ||||||||||||||||||||||||||||||||||||
| 1213 | if (textAfterSelection().length()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1214 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1215 | QString prefix = hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1216 | : text; | - | ||||||||||||||||||||||||||||||||||||
| 1217 | if (text.compare(m_completer->currentCompletion(), m_completer->caseSensitivity()) != 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1218 | || prefix.compare(m_completer->completionPrefix(), m_completer->caseSensitivity()) != 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1219 | m_completer->setCompletionPrefix(prefix); | - | ||||||||||||||||||||||||||||||||||||
| 1220 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1221 | n = (
| 0 | ||||||||||||||||||||||||||||||||||||
| 1222 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1223 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1224 | m_completer->setCompletionPrefix(text); | - | ||||||||||||||||||||||||||||||||||||
| 1225 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1226 | if (!advanceToEnabledItem(n)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1227 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1228 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1229 | - | |||||||||||||||||||||||||||||||||||||
| 1230 | if (text.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1231 | m_completer->popup()->hide(); | - | ||||||||||||||||||||||||||||||||||||
| 1232 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1233 | } | - | ||||||||||||||||||||||||||||||||||||
| 1234 | - | |||||||||||||||||||||||||||||||||||||
| 1235 | m_completer->setCompletionPrefix(text); | - | ||||||||||||||||||||||||||||||||||||
| 1236 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1237 | - | |||||||||||||||||||||||||||||||||||||
| 1238 | m_completer->complete(); | - | ||||||||||||||||||||||||||||||||||||
| 1239 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1240 | - | |||||||||||||||||||||||||||||||||||||
| 1241 | - | |||||||||||||||||||||||||||||||||||||
| 1242 | void QWidgetLineControl::setReadOnly(bool enable) | - | ||||||||||||||||||||||||||||||||||||
| 1243 | { | - | ||||||||||||||||||||||||||||||||||||
| 1244 | if (m_readOnly == enable
| 0 | ||||||||||||||||||||||||||||||||||||
| 1245 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1246 | - | |||||||||||||||||||||||||||||||||||||
| 1247 | m_readOnly = enable; | - | ||||||||||||||||||||||||||||||||||||
| 1248 | updateCursorBlinking(); | - | ||||||||||||||||||||||||||||||||||||
| 1249 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1250 | - | |||||||||||||||||||||||||||||||||||||
| 1251 | void QWidgetLineControl::setBlinkingCursorEnabled(bool enable) | - | ||||||||||||||||||||||||||||||||||||
| 1252 | { | - | ||||||||||||||||||||||||||||||||||||
| 1253 | if (m_blinkEnabled == enable
| 0 | ||||||||||||||||||||||||||||||||||||
| 1254 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1255 | - | |||||||||||||||||||||||||||||||||||||
| 1256 | m_blinkEnabled = enable; | - | ||||||||||||||||||||||||||||||||||||
| 1257 | - | |||||||||||||||||||||||||||||||||||||
| 1258 | if (enable
| 0 | ||||||||||||||||||||||||||||||||||||
| 1259 | connect((static_cast<QApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetLineControl::updateCursorBlinking); never executed: connect((static_cast<QApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetLineControl::updateCursorBlinking); | 0 | ||||||||||||||||||||||||||||||||||||
| 1260 | else | - | ||||||||||||||||||||||||||||||||||||
| 1261 | disconnect((static_cast<QApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetLineControl::updateCursorBlinking); never executed: disconnect((static_cast<QApplication *>(QCoreApplication::instance()))->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetLineControl::updateCursorBlinking); | 0 | ||||||||||||||||||||||||||||||||||||
| 1262 | - | |||||||||||||||||||||||||||||||||||||
| 1263 | updateCursorBlinking(); | - | ||||||||||||||||||||||||||||||||||||
| 1264 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1265 | - | |||||||||||||||||||||||||||||||||||||
| 1266 | void QWidgetLineControl::updateCursorBlinking() | - | ||||||||||||||||||||||||||||||||||||
| 1267 | { | - | ||||||||||||||||||||||||||||||||||||
| 1268 | if (m_blinkTimer
| 0 | ||||||||||||||||||||||||||||||||||||
| 1269 | killTimer(m_blinkTimer); | - | ||||||||||||||||||||||||||||||||||||
| 1270 | m_blinkTimer = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1271 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1272 | - | |||||||||||||||||||||||||||||||||||||
| 1273 | if (m_blinkEnabled
| 0 | ||||||||||||||||||||||||||||||||||||
| 1274 | int flashTime = QGuiApplication::styleHints()->cursorFlashTime(); | - | ||||||||||||||||||||||||||||||||||||
| 1275 | if (flashTime >= 2
| 0 | ||||||||||||||||||||||||||||||||||||
| 1276 | m_blinkTimer = startTimer(flashTime / 2); never executed: m_blinkTimer = startTimer(flashTime / 2); | 0 | ||||||||||||||||||||||||||||||||||||
| 1277 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1278 | - | |||||||||||||||||||||||||||||||||||||
| 1279 | m_blinkStatus = 1; | - | ||||||||||||||||||||||||||||||||||||
| 1280 | updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect()); | - | ||||||||||||||||||||||||||||||||||||
| 1281 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1282 | - | |||||||||||||||||||||||||||||||||||||
| 1283 | - | |||||||||||||||||||||||||||||||||||||
| 1284 | void QWidgetLineControl::resetCursorBlinkTimer() | - | ||||||||||||||||||||||||||||||||||||
| 1285 | { | - | ||||||||||||||||||||||||||||||||||||
| 1286 | if (!m_blinkEnabled
| 0 | ||||||||||||||||||||||||||||||||||||
| 1287 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1288 | killTimer(m_blinkTimer); | - | ||||||||||||||||||||||||||||||||||||
| 1289 | m_blinkTimer = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1290 | int flashTime = QGuiApplication::styleHints()->cursorFlashTime(); | - | ||||||||||||||||||||||||||||||||||||
| 1291 | if (flashTime >= 2
| 0 | ||||||||||||||||||||||||||||||||||||
| 1292 | m_blinkTimer = startTimer(flashTime / 2); never executed: m_blinkTimer = startTimer(flashTime / 2); | 0 | ||||||||||||||||||||||||||||||||||||
| 1293 | m_blinkStatus = 1; | - | ||||||||||||||||||||||||||||||||||||
| 1294 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1295 | - | |||||||||||||||||||||||||||||||||||||
| 1296 | void QWidgetLineControl::timerEvent(QTimerEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 1297 | { | - | ||||||||||||||||||||||||||||||||||||
| 1298 | if (event->timerId() == m_blinkTimer
| 0 | ||||||||||||||||||||||||||||||||||||
| 1299 | m_blinkStatus = !m_blinkStatus; | - | ||||||||||||||||||||||||||||||||||||
| 1300 | updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect()); | - | ||||||||||||||||||||||||||||||||||||
| 1301 | } never executed: else if (event->timerId() == m_deleteAllTimerend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1302 | killTimer(m_deleteAllTimer); | - | ||||||||||||||||||||||||||||||||||||
| 1303 | m_deleteAllTimer = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1304 | clear(); | - | ||||||||||||||||||||||||||||||||||||
| 1305 | } never executed: else if (event->timerId() == m_tripleClickTimerend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1306 | killTimer(m_tripleClickTimer); | - | ||||||||||||||||||||||||||||||||||||
| 1307 | m_tripleClickTimer = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1308 | } never executed: else if (event->timerId() == m_passwordEchoTimerend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1309 | killTimer(m_passwordEchoTimer); | - | ||||||||||||||||||||||||||||||||||||
| 1310 | m_passwordEchoTimer = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1311 | updateDisplayText(); | - | ||||||||||||||||||||||||||||||||||||
| 1312 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1313 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1314 | - | |||||||||||||||||||||||||||||||||||||
| 1315 | - | |||||||||||||||||||||||||||||||||||||
| 1316 | void QWidgetLineControl::processShortcutOverrideEvent(QKeyEvent *ke) | - | ||||||||||||||||||||||||||||||||||||
| 1317 | { | - | ||||||||||||||||||||||||||||||||||||
| 1318 | if (ke == QKeySequence::Copy
| 0 | ||||||||||||||||||||||||||||||||||||
| 1319 | || ke == QKeySequence::MoveToNextWord
| 0 | ||||||||||||||||||||||||||||||||||||
| 1320 | || ke == QKeySequence::MoveToPreviousWord
| 0 | ||||||||||||||||||||||||||||||||||||
| 1321 | || ke == QKeySequence::MoveToStartOfLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1322 | || ke == QKeySequence::MoveToEndOfLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1323 | || ke == QKeySequence::MoveToStartOfDocument
| 0 | ||||||||||||||||||||||||||||||||||||
| 1324 | || ke == QKeySequence::MoveToEndOfDocument
| 0 | ||||||||||||||||||||||||||||||||||||
| 1325 | || ke == QKeySequence::SelectNextWord
| 0 | ||||||||||||||||||||||||||||||||||||
| 1326 | || ke == QKeySequence::SelectPreviousWord
| 0 | ||||||||||||||||||||||||||||||||||||
| 1327 | || ke == QKeySequence::SelectStartOfLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1328 | || ke == QKeySequence::SelectEndOfLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1329 | || ke == QKeySequence::SelectStartOfBlock
| 0 | ||||||||||||||||||||||||||||||||||||
| 1330 | || ke == QKeySequence::SelectEndOfBlock
| 0 | ||||||||||||||||||||||||||||||||||||
| 1331 | || ke == QKeySequence::SelectStartOfDocument
| 0 | ||||||||||||||||||||||||||||||||||||
| 1332 | || ke == QKeySequence::SelectAll
| 0 | ||||||||||||||||||||||||||||||||||||
| 1333 | || ke == QKeySequence::SelectEndOfDocument
| 0 | ||||||||||||||||||||||||||||||||||||
| 1334 | ke->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 1335 | } never executed: else if (ke == QKeySequence::Pasteend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1336 | || ke == QKeySequence::Cut
| 0 | ||||||||||||||||||||||||||||||||||||
| 1337 | || ke == QKeySequence::Redo
| 0 | ||||||||||||||||||||||||||||||||||||
| 1338 | || ke == QKeySequence::Undo
| 0 | ||||||||||||||||||||||||||||||||||||
| 1339 | || ke == QKeySequence::DeleteCompleteLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1340 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1341 | ke->accept(); never executed: ke->accept(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1342 | } never executed: else if (ke->modifiers() == Qt::NoModifierend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1343 | || ke->modifiers() == Qt::KeypadModifier
| 0 | ||||||||||||||||||||||||||||||||||||
| 1344 | if (ke->key() < Qt::Key_Escape
| 0 | ||||||||||||||||||||||||||||||||||||
| 1345 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1346 | ke->accept(); never executed: ke->accept(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1347 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1348 | switch (ke->key()) { | - | ||||||||||||||||||||||||||||||||||||
| 1349 | case never executed: Qt::Key_Delete:case Qt::Key_Delete:never executed: case Qt::Key_Delete: | 0 | ||||||||||||||||||||||||||||||||||||
| 1350 | case never executed: Qt::Key_Backspace:case Qt::Key_Backspace:never executed: case Qt::Key_Backspace: | 0 | ||||||||||||||||||||||||||||||||||||
| 1351 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1352 | ke->accept(); never executed: ke->accept(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1353 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1354 | - | |||||||||||||||||||||||||||||||||||||
| 1355 | case never executed: Qt::Key_Home:case Qt::Key_Home:never executed: case Qt::Key_Home: | 0 | ||||||||||||||||||||||||||||||||||||
| 1356 | case never executed: Qt::Key_End:case Qt::Key_End:never executed: case Qt::Key_End: | 0 | ||||||||||||||||||||||||||||||||||||
| 1357 | case never executed: Qt::Key_Left:case Qt::Key_Left:never executed: case Qt::Key_Left: | 0 | ||||||||||||||||||||||||||||||||||||
| 1358 | case never executed: Qt::Key_Right:case Qt::Key_Right:never executed: case Qt::Key_Right: | 0 | ||||||||||||||||||||||||||||||||||||
| 1359 | ke->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 1360 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1361 | - | |||||||||||||||||||||||||||||||||||||
| 1362 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1363 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1364 | } | - | ||||||||||||||||||||||||||||||||||||
| 1365 | } | - | ||||||||||||||||||||||||||||||||||||
| 1366 | } | - | ||||||||||||||||||||||||||||||||||||
| 1367 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||||||||||||||
| 1369 | - | |||||||||||||||||||||||||||||||||||||
| 1370 | void QWidgetLineControl::processKeyEvent(QKeyEvent* event) | - | ||||||||||||||||||||||||||||||||||||
| 1371 | { | - | ||||||||||||||||||||||||||||||||||||
| 1372 | bool inlineCompletionAccepted = false; | - | ||||||||||||||||||||||||||||||||||||
| 1373 | - | |||||||||||||||||||||||||||||||||||||
| 1374 | - | |||||||||||||||||||||||||||||||||||||
| 1375 | if (m_completer
| 0 | ||||||||||||||||||||||||||||||||||||
| 1376 | QCompleter::CompletionMode completionMode = m_completer->completionMode(); | - | ||||||||||||||||||||||||||||||||||||
| 1377 | if ((completionMode == QCompleter::PopupCompletion
| 0 | ||||||||||||||||||||||||||||||||||||
| 1378 | || completionMode == QCompleter::UnfilteredPopupCompletion
| 0 | ||||||||||||||||||||||||||||||||||||
| 1379 | && m_completer->popup()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1380 | && m_completer->popup()->isVisible()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1381 | - | |||||||||||||||||||||||||||||||||||||
| 1382 | - | |||||||||||||||||||||||||||||||||||||
| 1383 | switch (event->key()) { | - | ||||||||||||||||||||||||||||||||||||
| 1384 | case never executed: Qt::Key_Escape:case Qt::Key_Escape:never executed: case Qt::Key_Escape: | 0 | ||||||||||||||||||||||||||||||||||||
| 1385 | event->ignore(); | - | ||||||||||||||||||||||||||||||||||||
| 1386 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1387 | case never executed: Qt::Key_Enter:case Qt::Key_Enter:never executed: case Qt::Key_Enter: | 0 | ||||||||||||||||||||||||||||||||||||
| 1388 | case never executed: Qt::Key_Return:case Qt::Key_Return:never executed: case Qt::Key_Return: | 0 | ||||||||||||||||||||||||||||||||||||
| 1389 | case never executed: Qt::Key_F4:case Qt::Key_F4:never executed: case Qt::Key_F4: | 0 | ||||||||||||||||||||||||||||||||||||
| 1390 | - | |||||||||||||||||||||||||||||||||||||
| 1391 | - | |||||||||||||||||||||||||||||||||||||
| 1392 | - | |||||||||||||||||||||||||||||||||||||
| 1393 | - | |||||||||||||||||||||||||||||||||||||
| 1394 | - | |||||||||||||||||||||||||||||||||||||
| 1395 | m_completer->popup()->hide(); | - | ||||||||||||||||||||||||||||||||||||
| 1396 | default never executed: :default:never executed: default:code before this statement never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1397 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1398 | } | - | ||||||||||||||||||||||||||||||||||||
| 1399 | } else if (completionMode == QCompleter::InlineCompletion
| 0 | ||||||||||||||||||||||||||||||||||||
| 1400 | switch (event->key()) { | - | ||||||||||||||||||||||||||||||||||||
| 1401 | case never executed: Qt::Key_Enter:case Qt::Key_Enter:never executed: case Qt::Key_Enter: | 0 | ||||||||||||||||||||||||||||||||||||
| 1402 | case never executed: Qt::Key_Return:case Qt::Key_Return:never executed: case Qt::Key_Return: | 0 | ||||||||||||||||||||||||||||||||||||
| 1403 | case never executed: Qt::Key_F4:case Qt::Key_F4:never executed: case Qt::Key_F4: | 0 | ||||||||||||||||||||||||||||||||||||
| 1404 | - | |||||||||||||||||||||||||||||||||||||
| 1405 | - | |||||||||||||||||||||||||||||||||||||
| 1406 | - | |||||||||||||||||||||||||||||||||||||
| 1407 | - | |||||||||||||||||||||||||||||||||||||
| 1408 | - | |||||||||||||||||||||||||||||||||||||
| 1409 | if (!m_completer->currentCompletion().isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1410 | && textAfterSelection().isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1411 | setText(m_completer->currentCompletion()); | - | ||||||||||||||||||||||||||||||||||||
| 1412 | inlineCompletionAccepted = true; | - | ||||||||||||||||||||||||||||||||||||
| 1413 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1414 | default never executed: :default:never executed: default:code before this statement never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1415 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1416 | } | - | ||||||||||||||||||||||||||||||||||||
| 1417 | } | - | ||||||||||||||||||||||||||||||||||||
| 1418 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1419 | - | |||||||||||||||||||||||||||||||||||||
| 1420 | - | |||||||||||||||||||||||||||||||||||||
| 1421 | if (event->key() == Qt::Key_Enter
| 0 | ||||||||||||||||||||||||||||||||||||
| 1422 | if (hasAcceptableInput()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1423 | - | |||||||||||||||||||||||||||||||||||||
| 1424 | QInputMethod *inputMethod = QApplication::inputMethod(); | - | ||||||||||||||||||||||||||||||||||||
| 1425 | inputMethod->commit(); | - | ||||||||||||||||||||||||||||||||||||
| 1426 | QWidget *lineEdit = qobject_cast<QWidget *>(parent()); | - | ||||||||||||||||||||||||||||||||||||
| 1427 | if (!(lineEdit
| 0 | ||||||||||||||||||||||||||||||||||||
| 1428 | inputMethod->hide(); never executed: inputMethod->hide(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1429 | - | |||||||||||||||||||||||||||||||||||||
| 1430 | accepted(); | - | ||||||||||||||||||||||||||||||||||||
| 1431 | editingFinished(); | - | ||||||||||||||||||||||||||||||||||||
| 1432 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1433 | if (inlineCompletionAccepted
| 0 | ||||||||||||||||||||||||||||||||||||
| 1434 | event->accept(); never executed: event->accept(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1435 | else | - | ||||||||||||||||||||||||||||||||||||
| 1436 | event->ignore(); never executed: event->ignore(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1437 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1438 | } | - | ||||||||||||||||||||||||||||||||||||
| 1439 | - | |||||||||||||||||||||||||||||||||||||
| 1440 | if (echoMode() == QLineEdit::PasswordEchoOnEdit
| 0 | ||||||||||||||||||||||||||||||||||||
| 1441 | && !passwordEchoEditing()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1442 | && !isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1443 | && !event->text().isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1444 | - | |||||||||||||||||||||||||||||||||||||
| 1445 | - | |||||||||||||||||||||||||||||||||||||
| 1446 | - | |||||||||||||||||||||||||||||||||||||
| 1447 | - | |||||||||||||||||||||||||||||||||||||
| 1448 | - | |||||||||||||||||||||||||||||||||||||
| 1449 | - | |||||||||||||||||||||||||||||||||||||
| 1450 | && !(event->modifiers() & Qt::ControlModifier)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1451 | - | |||||||||||||||||||||||||||||||||||||
| 1452 | - | |||||||||||||||||||||||||||||||||||||
| 1453 | - | |||||||||||||||||||||||||||||||||||||
| 1454 | - | |||||||||||||||||||||||||||||||||||||
| 1455 | - | |||||||||||||||||||||||||||||||||||||
| 1456 | updatePasswordEchoEditing(true); | - | ||||||||||||||||||||||||||||||||||||
| 1457 | clear(); | - | ||||||||||||||||||||||||||||||||||||
| 1458 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1459 | - | |||||||||||||||||||||||||||||||||||||
| 1460 | bool unknown = false; | - | ||||||||||||||||||||||||||||||||||||
| 1461 | bool visual = cursorMoveStyle() == Qt::VisualMoveStyle; | - | ||||||||||||||||||||||||||||||||||||
| 1462 | - | |||||||||||||||||||||||||||||||||||||
| 1463 | if (false) { dead code: { } | - | ||||||||||||||||||||||||||||||||||||
| 1464 | } dead code: { } | - | ||||||||||||||||||||||||||||||||||||
| 1465 | - | |||||||||||||||||||||||||||||||||||||
| 1466 | else if (event == QKeySequence::Undo
| 0 | ||||||||||||||||||||||||||||||||||||
| 1467 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1468 | undo(); never executed: undo(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1469 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1470 | else if (event == QKeySequence::Redo
| 0 | ||||||||||||||||||||||||||||||||||||
| 1471 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1472 | redo(); never executed: redo(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1473 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1474 | else if (event == QKeySequence::SelectAll
| 0 | ||||||||||||||||||||||||||||||||||||
| 1475 | selectAll(); | - | ||||||||||||||||||||||||||||||||||||
| 1476 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1477 | - | |||||||||||||||||||||||||||||||||||||
| 1478 | else if (event == QKeySequence::Copy
| 0 | ||||||||||||||||||||||||||||||||||||
| 1479 | copy(); | - | ||||||||||||||||||||||||||||||||||||
| 1480 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1481 | else if (event == QKeySequence::Paste
| 0 | ||||||||||||||||||||||||||||||||||||
| 1482 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1483 | QClipboard::Mode mode = QClipboard::Clipboard; | - | ||||||||||||||||||||||||||||||||||||
| 1484 | if (m_keyboardScheme == QPlatformTheme::X11KeyboardScheme
| 0 | ||||||||||||||||||||||||||||||||||||
| 1485 | && event->modifiers() == (Qt::CTRL | Qt::SHIFT)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1486 | && event->key() == Qt::Key_Insert
| 0 | ||||||||||||||||||||||||||||||||||||
| 1487 | mode = QClipboard::Selection; | - | ||||||||||||||||||||||||||||||||||||
| 1488 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1489 | paste(mode); | - | ||||||||||||||||||||||||||||||||||||
| 1490 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1491 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1492 | else if (event == QKeySequence::Cut
| 0 | ||||||||||||||||||||||||||||||||||||
| 1493 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1494 | copy(); | - | ||||||||||||||||||||||||||||||||||||
| 1495 | del(); | - | ||||||||||||||||||||||||||||||||||||
| 1496 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1497 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1498 | else if (event == QKeySequence::DeleteEndOfLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1499 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1500 | setSelection(cursor(), end()); | - | ||||||||||||||||||||||||||||||||||||
| 1501 | copy(); | - | ||||||||||||||||||||||||||||||||||||
| 1502 | del(); | - | ||||||||||||||||||||||||||||||||||||
| 1503 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1504 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1505 | - | |||||||||||||||||||||||||||||||||||||
| 1506 | else if (event == QKeySequence::MoveToStartOfLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1507 | home(0); | - | ||||||||||||||||||||||||||||||||||||
| 1508 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1509 | else if (event == QKeySequence::MoveToEndOfLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1510 | end(0); | - | ||||||||||||||||||||||||||||||||||||
| 1511 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1512 | else if (event == QKeySequence::SelectStartOfLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1513 | home(1); | - | ||||||||||||||||||||||||||||||||||||
| 1514 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1515 | else if (event == QKeySequence::SelectEndOfLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1516 | end(1); | - | ||||||||||||||||||||||||||||||||||||
| 1517 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1518 | else if (event == QKeySequence::MoveToNextChar
| 0 | ||||||||||||||||||||||||||||||||||||
| 1519 | - | |||||||||||||||||||||||||||||||||||||
| 1520 | - | |||||||||||||||||||||||||||||||||||||
| 1521 | - | |||||||||||||||||||||||||||||||||||||
| 1522 | const bool inlineCompletion = m_completer
| 0 | ||||||||||||||||||||||||||||||||||||
| 1523 | - | |||||||||||||||||||||||||||||||||||||
| 1524 | if (hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1525 | && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
| 0 | ||||||||||||||||||||||||||||||||||||
| 1526 | || inlineCompletion
| 0 | ||||||||||||||||||||||||||||||||||||
| 1527 | moveCursor(selectionEnd(), false); | - | ||||||||||||||||||||||||||||||||||||
| 1528 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1529 | cursorForward(0, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); | - | ||||||||||||||||||||||||||||||||||||
| 1530 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1531 | } | - | ||||||||||||||||||||||||||||||||||||
| 1532 | else if (event == QKeySequence::SelectNextChar
| 0 | ||||||||||||||||||||||||||||||||||||
| 1533 | cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); | - | ||||||||||||||||||||||||||||||||||||
| 1534 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1535 | else if (event == QKeySequence::MoveToPreviousChar
| 0 | ||||||||||||||||||||||||||||||||||||
| 1536 | - | |||||||||||||||||||||||||||||||||||||
| 1537 | - | |||||||||||||||||||||||||||||||||||||
| 1538 | - | |||||||||||||||||||||||||||||||||||||
| 1539 | const bool inlineCompletion = m_completer
| 0 | ||||||||||||||||||||||||||||||||||||
| 1540 | - | |||||||||||||||||||||||||||||||||||||
| 1541 | if (hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1542 | && (m_keyboardScheme != QPlatformTheme::WindowsKeyboardScheme
| 0 | ||||||||||||||||||||||||||||||||||||
| 1543 | || inlineCompletion
| 0 | ||||||||||||||||||||||||||||||||||||
| 1544 | moveCursor(selectionStart(), false); | - | ||||||||||||||||||||||||||||||||||||
| 1545 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1546 | cursorForward(0, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1547 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1548 | } | - | ||||||||||||||||||||||||||||||||||||
| 1549 | else if (event == QKeySequence::SelectPreviousChar
| 0 | ||||||||||||||||||||||||||||||||||||
| 1550 | cursorForward(1, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1551 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1552 | else if (event == QKeySequence::MoveToNextWord
| 0 | ||||||||||||||||||||||||||||||||||||
| 1553 | if (echoMode() == QLineEdit::Normal
| 0 | ||||||||||||||||||||||||||||||||||||
| 1554 | layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0); never executed: layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1555 | else | - | ||||||||||||||||||||||||||||||||||||
| 1556 | layoutDirection() == Qt::LeftToRight ? end(0) : home(0); never executed: layoutDirection() == Qt::LeftToRight ? end(0) : home(0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1557 | } | - | ||||||||||||||||||||||||||||||||||||
| 1558 | else if (event == QKeySequence::MoveToPreviousWord
| 0 | ||||||||||||||||||||||||||||||||||||
| 1559 | if (echoMode() == QLineEdit::Normal
| 0 | ||||||||||||||||||||||||||||||||||||
| 1560 | layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0); never executed: layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1561 | else if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1562 | layoutDirection() == Qt::LeftToRight ? home(0) : end(0); | - | ||||||||||||||||||||||||||||||||||||
| 1563 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1564 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1565 | else if (event == QKeySequence::SelectNextWord
| 0 | ||||||||||||||||||||||||||||||||||||
| 1566 | if (echoMode() == QLineEdit::Normal
| 0 | ||||||||||||||||||||||||||||||||||||
| 1567 | layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1); never executed: layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1); | 0 | ||||||||||||||||||||||||||||||||||||
| 1568 | else | - | ||||||||||||||||||||||||||||||||||||
| 1569 | layoutDirection() == Qt::LeftToRight ? end(1) : home(1); never executed: layoutDirection() == Qt::LeftToRight ? end(1) : home(1); | 0 | ||||||||||||||||||||||||||||||||||||
| 1570 | } | - | ||||||||||||||||||||||||||||||||||||
| 1571 | else if (event == QKeySequence::SelectPreviousWord
| 0 | ||||||||||||||||||||||||||||||||||||
| 1572 | if (echoMode() == QLineEdit::Normal
| 0 | ||||||||||||||||||||||||||||||||||||
| 1573 | layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1); never executed: layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1); | 0 | ||||||||||||||||||||||||||||||||||||
| 1574 | else | - | ||||||||||||||||||||||||||||||||||||
| 1575 | layoutDirection() == Qt::LeftToRight ? home(1) : end(1); never executed: layoutDirection() == Qt::LeftToRight ? home(1) : end(1); | 0 | ||||||||||||||||||||||||||||||||||||
| 1576 | } | - | ||||||||||||||||||||||||||||||||||||
| 1577 | else if (event == QKeySequence::Delete
| 0 | ||||||||||||||||||||||||||||||||||||
| 1578 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1579 | del(); never executed: del(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1580 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1581 | else if (event == QKeySequence::DeleteEndOfWord
| 0 | ||||||||||||||||||||||||||||||||||||
| 1582 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1583 | cursorWordForward(true); | - | ||||||||||||||||||||||||||||||||||||
| 1584 | del(); | - | ||||||||||||||||||||||||||||||||||||
| 1585 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1586 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1587 | else if (event == QKeySequence::DeleteStartOfWord
| 0 | ||||||||||||||||||||||||||||||||||||
| 1588 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1589 | cursorWordBackward(true); | - | ||||||||||||||||||||||||||||||||||||
| 1590 | del(); | - | ||||||||||||||||||||||||||||||||||||
| 1591 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1592 | } never executed: else if (event == QKeySequence::DeleteCompleteLineend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1593 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1594 | setSelection(0, text().size()); | - | ||||||||||||||||||||||||||||||||||||
| 1595 | - | |||||||||||||||||||||||||||||||||||||
| 1596 | copy(); | - | ||||||||||||||||||||||||||||||||||||
| 1597 | - | |||||||||||||||||||||||||||||||||||||
| 1598 | del(); | - | ||||||||||||||||||||||||||||||||||||
| 1599 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1600 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1601 | - | |||||||||||||||||||||||||||||||||||||
| 1602 | else { | - | ||||||||||||||||||||||||||||||||||||
| 1603 | bool handled = false; | - | ||||||||||||||||||||||||||||||||||||
| 1604 | if (m_keyboardScheme == QPlatformTheme::MacKeyboardScheme
| 0 | ||||||||||||||||||||||||||||||||||||
| 1605 | && (event->key() == Qt::Key_Up
| 0 | ||||||||||||||||||||||||||||||||||||
| 1606 | Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier); | - | ||||||||||||||||||||||||||||||||||||
| 1607 | if (myModifiers & Qt::ShiftModifier
| 0 | ||||||||||||||||||||||||||||||||||||
| 1608 | if (myModifiers == (Qt::ControlModifier|Qt::ShiftModifier)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1609 | || myModifiers == (Qt::AltModifier|Qt::ShiftModifier)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1610 | || myModifiers == Qt::ShiftModifier
| 0 | ||||||||||||||||||||||||||||||||||||
| 1611 | - | |||||||||||||||||||||||||||||||||||||
| 1612 | event->key() == Qt::Key_Up ? home(1) : end(1); | - | ||||||||||||||||||||||||||||||||||||
| 1613 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1614 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1615 | if ((myModifiers == Qt::ControlModifier
| 0 | ||||||||||||||||||||||||||||||||||||
| 1616 | || myModifiers == Qt::AltModifier
| 0 | ||||||||||||||||||||||||||||||||||||
| 1617 | || myModifiers == Qt::NoModifier
| 0 | ||||||||||||||||||||||||||||||||||||
| 1618 | event->key() == Qt::Key_Up ? home(0) : end(0); | - | ||||||||||||||||||||||||||||||||||||
| 1619 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1620 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1621 | handled = true; | - | ||||||||||||||||||||||||||||||||||||
| 1622 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1623 | if (event->modifiers() & Qt::ControlModifier
| 0 | ||||||||||||||||||||||||||||||||||||
| 1624 | switch (event->key()) { | - | ||||||||||||||||||||||||||||||||||||
| 1625 | case never executed: Qt::Key_Backspace:case Qt::Key_Backspace:never executed: case Qt::Key_Backspace: | 0 | ||||||||||||||||||||||||||||||||||||
| 1626 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1627 | cursorWordBackward(true); | - | ||||||||||||||||||||||||||||||||||||
| 1628 | del(); | - | ||||||||||||||||||||||||||||||||||||
| 1629 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1630 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1631 | - | |||||||||||||||||||||||||||||||||||||
| 1632 | case never executed: Qt::Key_Up:case Qt::Key_Up:never executed: case Qt::Key_Up: | 0 | ||||||||||||||||||||||||||||||||||||
| 1633 | case never executed: Qt::Key_Down:case Qt::Key_Down:never executed: case Qt::Key_Down: | 0 | ||||||||||||||||||||||||||||||||||||
| 1634 | complete(event->key()); | - | ||||||||||||||||||||||||||||||||||||
| 1635 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1636 | - | |||||||||||||||||||||||||||||||||||||
| 1637 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1638 | if (!handled
| 0 | ||||||||||||||||||||||||||||||||||||
| 1639 | unknown = true; never executed: unknown = true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1640 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1641 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1642 | switch (event->key()) { | - | ||||||||||||||||||||||||||||||||||||
| 1643 | case never executed: Qt::Key_Backspace:case Qt::Key_Backspace:never executed: case Qt::Key_Backspace: | 0 | ||||||||||||||||||||||||||||||||||||
| 1644 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1645 | backspace(); | - | ||||||||||||||||||||||||||||||||||||
| 1646 | - | |||||||||||||||||||||||||||||||||||||
| 1647 | complete(Qt::Key_Backspace); | - | ||||||||||||||||||||||||||||||||||||
| 1648 | - | |||||||||||||||||||||||||||||||||||||
| 1649 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1650 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1651 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1652 | if (!handled
| 0 | ||||||||||||||||||||||||||||||||||||
| 1653 | unknown = true; never executed: unknown = true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1654 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1655 | } | - | ||||||||||||||||||||||||||||||||||||
| 1656 | } | - | ||||||||||||||||||||||||||||||||||||
| 1657 | - | |||||||||||||||||||||||||||||||||||||
| 1658 | if (event->key() == Qt::Key_Direction_L
| 0 | ||||||||||||||||||||||||||||||||||||
| 1659 | setLayoutDirection((event->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft); | - | ||||||||||||||||||||||||||||||||||||
| 1660 | unknown = false; | - | ||||||||||||||||||||||||||||||||||||
| 1661 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1662 | - | |||||||||||||||||||||||||||||||||||||
| 1663 | - | |||||||||||||||||||||||||||||||||||||
| 1664 | if (unknown
| 0 | ||||||||||||||||||||||||||||||||||||
| 1665 | && event->modifiers() != Qt::ControlModifier
| 0 | ||||||||||||||||||||||||||||||||||||
| 1666 | && event->modifiers() != (Qt::ControlModifier | Qt::ShiftModifier)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1667 | QString t = event->text(); | - | ||||||||||||||||||||||||||||||||||||
| 1668 | if (!t.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1669 | insert(t); | - | ||||||||||||||||||||||||||||||||||||
| 1670 | - | |||||||||||||||||||||||||||||||||||||
| 1671 | complete(event->key()); | - | ||||||||||||||||||||||||||||||||||||
| 1672 | - | |||||||||||||||||||||||||||||||||||||
| 1673 | event->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 1674 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1675 | } | - | ||||||||||||||||||||||||||||||||||||
| 1676 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1677 | - | |||||||||||||||||||||||||||||||||||||
| 1678 | if (unknown
| 0 | ||||||||||||||||||||||||||||||||||||
| 1679 | event->ignore(); never executed: event->ignore(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1680 | else | - | ||||||||||||||||||||||||||||||||||||
| 1681 | event->accept(); never executed: event->accept(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1682 | } | - | ||||||||||||||||||||||||||||||||||||
| 1683 | - | |||||||||||||||||||||||||||||||||||||
| 1684 | bool QWidgetLineControl::isUndoAvailable() const | - | ||||||||||||||||||||||||||||||||||||
| 1685 | { | - | ||||||||||||||||||||||||||||||||||||
| 1686 | - | |||||||||||||||||||||||||||||||||||||
| 1687 | - | |||||||||||||||||||||||||||||||||||||
| 1688 | return never executed: !m_readOnly && m_undoStatereturn !m_readOnly && m_undoState && (m_echoMode == QLineEdit::Normal || m_history[m_undoState - 1].type == QWidgetLineControl::Insert);never executed: return !m_readOnly && m_undoState && (m_echoMode == QLineEdit::Normal || m_history[m_undoState - 1].type == QWidgetLineControl::Insert); | 0 | ||||||||||||||||||||||||||||||||||||
| 1689 | && (m_echoMode == QLineEdit::Normal || m_history[m_undoState - 1].type == QWidgetLineControl::Insert); never executed: return !m_readOnly && m_undoState && (m_echoMode == QLineEdit::Normal || m_history[m_undoState - 1].type == QWidgetLineControl::Insert); | 0 | ||||||||||||||||||||||||||||||||||||
| 1690 | } | - | ||||||||||||||||||||||||||||||||||||
| 1691 | - | |||||||||||||||||||||||||||||||||||||
| 1692 | bool QWidgetLineControl::isRedoAvailable() const | - | ||||||||||||||||||||||||||||||||||||
| 1693 | { | - | ||||||||||||||||||||||||||||||||||||
| 1694 | - | |||||||||||||||||||||||||||||||||||||
| 1695 | return never executed: !m_readOnlyreturn !m_readOnly && m_echoMode == QLineEdit::Normal && m_undoState < int(m_history.size());never executed: return !m_readOnly && m_echoMode == QLineEdit::Normal && m_undoState < int(m_history.size()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1696 | && m_echoMode == QLineEdit::Normal never executed: return !m_readOnly && m_echoMode == QLineEdit::Normal && m_undoState < int(m_history.size()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1697 | && m_undoState < int(m_history.size()); never executed: return !m_readOnly && m_echoMode == QLineEdit::Normal && m_undoState < int(m_history.size()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1698 | } | - | ||||||||||||||||||||||||||||||||||||
| 1699 | - | |||||||||||||||||||||||||||||||||||||
| 1700 | - | |||||||||||||||||||||||||||||||||||||
| 1701 | - | |||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |