aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2013-10-17 19:02:25 +0200
committerhjk <hjk121@nokiamail.com>2013-10-21 14:15:56 +0200
commit8c02d6e0dd1b9acf897c7cfb63a92845eb458d8f (patch)
tree35191ff57c6fb19a2a2717ee5b6903ae54ec4e8c
parent59fd03abc3af1fd254f6f60ee512b2cc9c12ec5c (diff)
Debugger: Fix QChar dumper with Python 3
Change-Id: I7da412c9bdaf3a8f65484ac99f06fc31a5cdc1c3 Reviewed-by: hjk <hjk121@nokiamail.com>
-rw-r--r--share/qtcreator/debugger/qttypes.py14
-rw-r--r--src/plugins/debugger/watchhandler.cpp2
-rw-r--r--tests/auto/debugger/tst_dumpers.cpp14
3 files changed, 13 insertions, 17 deletions
diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py
index 3c9dbf9615..726fce04ce 100644
--- a/share/qtcreator/debugger/qttypes.py
+++ b/share/qtcreator/debugger/qttypes.py
@@ -70,20 +70,8 @@ def qdump__QByteArray(d, value):
d.putArrayData(d.charType(), data, size)
-def str2Utf8hex2(s):
- # Returns UTF-8 hex-data of string suitable for QByteArray::fromHex()
- ret = []
- for c in s.encode('utf-8'):
- ret.append('%02x' % ord(c))
- return ''.join(ret)
-
def qdump__QChar(d, value):
- ucs = int(value["ucs"])
- if ucs < 32:
- ch = '?'
- else:
- ch = unichr(ucs)
- d.putValue(str2Utf8hex2(u"'%s' (%d)" % (ch, ucs)), Hex2EncodedUtf8WithoutQuotes)
+ d.putValue(int(value["ucs"]))
d.putNumChild(0)
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index afff80085b..0082315158 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -645,7 +645,7 @@ QString WatchModel::formattedValue(const WatchData &data) const
if (isIntegralValue(value)) {
// Append quoted, printable character also for decimal.
const int format = itemFormat(data);
- if (data.type.endsWith("char")) {
+ if (data.type.endsWith("char") || data.type.endsWith("QChar")) {
bool ok;
const int code = value.toInt(&ok);
return ok ? reformatCharacter(code, format) : value;
diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp
index 01f2cbbca4..be7397df11 100644
--- a/tests/auto/debugger/tst_dumpers.cpp
+++ b/tests/auto/debugger/tst_dumpers.cpp
@@ -1163,6 +1163,14 @@ void tst_Dumpers::dumper_data()
% Check("ba1", "\"Hell\"", "@QByteArray")
% Check("ba2", "\"ello\"", "@QByteArray");
+ QTest::newRow("QChar")
+ << Data("#include <QString>\n",
+ "QString s = QLatin1String(\"x\");\n"
+ "QChar c = s.at(0);\n"
+ "unused(&c);\n")
+ % CoreProfile()
+ % Check("c", "120", "@QChar");
+
QTest::newRow("QDate0")
<< Data("#include <QDate>\n",
"QDate date;\n"
@@ -1653,8 +1661,8 @@ void tst_Dumpers::dumper_data()
% CoreProfile()
% Check("l0", "<0 items>", "@QList<@QChar>")
% Check("l", "<3 items>", "@QList<@QChar>")
- % Check("l.0", "[0]", "'a' (97)", "@QChar")
- % Check("l.2", "[2]", "'c' (99)", "@QChar");
+ % Check("l.0", "[0]", "97", "@QChar")
+ % Check("l.2", "[2]", "99", "@QChar");
QTest::newRow("QListQULongLong")
<< Data("#include <QList>\n",
@@ -3370,7 +3378,7 @@ void tst_Dumpers::dumper_data()
% Check("var4", "4", "@QVariant (qlonglong)")
% Check("var5", "5", "@QVariant (qulonglong)")
% Check("var6", "6.0", "@QVariant (double)")
- % Check("var7", "'?' (7)", "@QVariant (QChar)")
+ % Check("var7", "7", "@QVariant (QChar)")
% Check("var10", "\"Hello 10\"", "@QVariant (QString)")
% Check("var11", "<2 items>", "@QVariant (QStringList)")
% Check("var11.1", "[1]", "\"World\"", "@QString")