From 2bc05725533585e8b64a7cc1962f4e6ba5099356 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 26 Jan 2024 11:02:37 +0100 Subject: [PATCH] Debugger: Display length of quoted values Reverts 6515f935d6a8593eb7c2d01c09d16d1ad8135f6f as this breaks the dumper tests and moves the handling from the protocol to the item, so this now only happens for the gui. Change-Id: Ia15d5ead5c549585f4e90cc46d629961ea7d5974 Reviewed-by: hjk Reviewed-by: David Schulz --- src/plugins/debugger/debuggerprotocol.cpp | 2 +- src/plugins/debugger/watchhandler.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp index 1fb4418d34d..6df472afa52 100644 --- a/src/plugins/debugger/debuggerprotocol.cpp +++ b/src/plugins/debugger/debuggerprotocol.cpp @@ -753,7 +753,7 @@ QString decodeData(const QString &ba, const QString &encoding) if (enc.quotes) { const QChar doubleQuote('"'); - result = QString("%1 (%2)").arg(doubleQuote + result + doubleQuote).arg(result.size()); + result = doubleQuote + result + doubleQuote; } return result; } diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 42f2d8f54d0..eef0ba5a3ba 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -942,7 +942,10 @@ static QString displayName(const WatchItem *item) void WatchItem::updateValueCache() const { - valueCache = truncateValue(formattedValue(this)); + QString formatted = truncateValue(formattedValue(this)); + if (formatted.endsWith('"')) + formatted.append(QString(" (%1)").arg(this->value.length() - 2)); + valueCache = formatted; valueCache = watchModel(this)->removeNamespaces(valueCache); if (valueCache.isEmpty() && this->address) valueCache += QString::fromLatin1("@0x" + QByteArray::number(this->address, 16));