* @brief Reformats @a text as spaced byte pairs for byte-oriented display. */
| 404 | * @brief Reformats @a text as spaced byte pairs for byte-oriented display. |
| 405 | */ |
| 406 | QString Console::Handler::formatUserHex(const QString& text) |
| 407 | { |
| 408 | static QRegularExpression exp("[^0-9A-Fa-f]"); |
| 409 | QString data = text.simplified().remove(exp); |
| 410 | |
| 411 | QString str; |
| 412 | for (int i = 0; i < data.length(); ++i) { |
| 413 | str.append(data.at(i)); |
| 414 | if ((i + 1) % 2 == 0 && i > 0) |
| 415 | str.append(" "); |
| 416 | } |
| 417 | |
| 418 | while (str.endsWith(" ")) |
| 419 | str.chop(1); |
| 420 | |
| 421 | return str; |
| 422 | } |
| 423 | |
| 424 | /** |
| 425 | * @brief Clears the console text and per-device buffer for the current device. |