debugger: make QByteArray displayable in separate window

Change-Id: I6ec1e880e1c82415361545f57115353d843ee7f3
(cherry picked from commit ce381a81cf03bb122a9ce4102fbbb56825ce05e3)
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2012-10-04 13:03:01 +02:00
parent f02c0f64e2
commit b3c6f7be3f
2 changed files with 22 additions and 2 deletions

View File

@@ -1649,7 +1649,9 @@ void WatchHandler::showEditValue(const WatchData &data)
l->setPixmap(QPixmap::fromImage(im));
l->resize(width, height);
l->show();
} else if (data.editformat == 2) {
} else if (data.editformat == 2
|| data.editformat == 5
|| data.editformat == 6) {
// Display QString in a separate widget.
QTextEdit *t = qobject_cast<QTextEdit *>(w);
if (!t) {
@@ -1658,7 +1660,13 @@ void WatchHandler::showEditValue(const WatchData &data)
m_model->m_editHandlers[key] = t;
}
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->resize(400, 200);
t->show();