Commit b3c6f7be authored by hjk's avatar hjk
Browse files

debugger: make QByteArray displayable in separate window



Change-Id: I6ec1e880e1c82415361545f57115353d843ee7f3
(cherry picked from commit ce381a81cf03bb122a9ce4102fbbb56825ce05e3)
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent f02c0f64
...@@ -43,10 +43,22 @@ def qdump__QBasicAtomicPointer(d, value): ...@@ -43,10 +43,22 @@ def qdump__QBasicAtomicPointer(d, value):
d.putItem(value["_q_value"]) d.putItem(value["_q_value"])
def qform__QByteArray():
return "Inline,As Latin1 in Separate Window,As UTF-8 in Separate Window"
def qdump__QByteArray(d, value): def qdump__QByteArray(d, value):
d.putByteArrayValue(value) d.putByteArrayValue(value)
data, size, alloc = qByteArrayData(value) data, size, alloc = qByteArrayData(value)
d.putNumChild(size) d.putNumChild(size)
format = d.currentItemFormat()
if format == 1:
d.putDisplay(StopDisplay)
elif format == 2:
d.putField("editformat", 5)
d.putField("editvalue", encodeByteArray(value))
elif format == 3:
d.putField("editformat", 6)
d.putField("editvalue", encodeByteArray(value))
if d.isExpanded(): if d.isExpanded():
d.putArrayData(lookupType("char"), data, size) d.putArrayData(lookupType("char"), data, size)
......
...@@ -1649,7 +1649,9 @@ void WatchHandler::showEditValue(const WatchData &data) ...@@ -1649,7 +1649,9 @@ void WatchHandler::showEditValue(const WatchData &data)
l->setPixmap(QPixmap::fromImage(im)); l->setPixmap(QPixmap::fromImage(im));
l->resize(width, height); l->resize(width, height);
l->show(); l->show();
} else if (data.editformat == 2) { } else if (data.editformat == 2
|| data.editformat == 5
|| data.editformat == 6) {
// Display QString in a separate widget. // Display QString in a separate widget.
QTextEdit *t = qobject_cast<QTextEdit *>(w); QTextEdit *t = qobject_cast<QTextEdit *>(w);
if (!t) { if (!t) {
...@@ -1658,7 +1660,13 @@ void WatchHandler::showEditValue(const WatchData &data) ...@@ -1658,7 +1660,13 @@ void WatchHandler::showEditValue(const WatchData &data)
m_model->m_editHandlers[key] = t; m_model->m_editHandlers[key] = t;
} }
QByteArray ba = QByteArray::fromHex(data.editvalue); QByteArray ba = QByteArray::fromHex(data.editvalue);
QString str = QString::fromUtf16((ushort *)ba.constData(), ba.size()/2); QString str;
if (data.editformat == 2) // UTF-16
str = QString::fromUtf16((ushort *)ba.constData(), ba.size()/2);
else if (data.editformat == 5) // Latin1
str = QString::fromLatin1(ba.constData(), ba.size());
else if (data.editformat == 6) // UTF-8
str = QString::fromUtf8(ba.constData(), ba.size());
t->setText(str); t->setText(str);
t->resize(400, 200); t->resize(400, 200);
t->show(); t->show();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment