diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 860baa8b140fa7561935e6e8ff890c3abf46ac61..d40f1763ef56335ead79db37fffe9e74599aceab 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -1520,7 +1520,7 @@ void GdbEngine::handleHasPython(const GdbResponse &response)
         data.fromStringMultiple(contents.data());
         const GdbMi dumpers = data.findChild("dumpers");
         foreach (const GdbMi &dumper, dumpers.children()) {
-            QString type = _(dumper.findChild("type").data());
+            QByteArray type = dumper.findChild("type").data();
             QStringList formats(tr("Raw structure"));
             QString reported = _(dumper.findChild("formats").data());
             formats.append(reported.split(_(","), QString::SkipEmptyParts));
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 47e1c1179d4c27fee7df55844d0df7f8023f7b8b..b913fd3ff9191a3e9c667ff969b7cd20f3390f93 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -251,13 +251,13 @@ static QByteArray parentName(const QByteArray &iname)
 static QString chopConst(QString type)
 {
    while (1) {
-        if (type.startsWith("const"))
+        if (type.startsWith(QLatin1String("const")))
             type = type.mid(5);
-        else if (type.startsWith(' '))
+        else if (type.startsWith(QLatin1Char(' ')))
             type = type.mid(1);
-        else if (type.endsWith("const"))
+        else if (type.endsWith(QLatin1String("const")))
             type.chop(5);
-        else if (type.endsWith(' '))
+        else if (type.endsWith(QLatin1Char(' ')))
             type.chop(1);
         else
             break;
@@ -279,14 +279,14 @@ static inline QRegExp stdStringRegExp(const QString &charType)
     return re;
 }
 
-static QString niceTypeHelper(const QString typeIn)
+static QByteArray niceTypeHelper(const QByteArray typeIn)
 {
-    static QMap<QString, QString> cache;
-    const QMap<QString, QString>::const_iterator it = cache.constFind(typeIn);
+    static QMap<QByteArray, QByteArray> cache;
+    const QMap<QByteArray, QByteArray>::const_iterator it = cache.constFind(typeIn);
     if (it != cache.constEnd())
         return it.value();
 
-    QString type = typeIn;
+    QString type = QString::fromUtf8(typeIn);
     type.replace(QLatin1Char('*'), QLatin1Char('@'));
 
     for (int i = 0; i < 10; ++i) {
@@ -375,19 +375,20 @@ static QString niceTypeHelper(const QString typeIn)
             }
         }
     }
-    type.replace(QLatin1Char('@'), QLatin1Char('*'));
-    type.replace(QLatin1String(" >"), QString(QLatin1Char('>')));
-    cache.insert(typeIn, type); // For simplicity, also cache unmodified types
-    return type;
+    QByteArray typeOut = type.toUtf8();
+    typeOut.replace('@', '*');
+    typeOut.replace(" >", ">");
+    cache.insert(typeIn, typeOut); // For simplicity, also cache unmodified types
+    return typeOut;
 }
 
-QString WatchModel::niceType(const QString &typeIn) const
+QByteArray WatchModel::niceType(const QByteArray &typeIn) const
 {
-    QString type = niceTypeHelper(typeIn);
+    QByteArray type = niceTypeHelper(typeIn);
     if (!theDebuggerBoolSetting(ShowStdNamespace))
-        type = type.remove("std::");
+        type.replace("std::", "");
     if (!theDebuggerBoolSetting(ShowQtNamespace))
-        type = type.remove(engine()->qtNamespace());
+        type.replace(engine()->qtNamespace(), "");
     return type;
 }
 
@@ -626,7 +627,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
                 case 2: {
                     if (!data.displayedType.isEmpty())
                         return data.displayedType;
-                    return niceType(data.type);
+                    return QString::fromUtf8(niceType(data.type));
                 }
                 default: break;
             }
@@ -1443,14 +1444,14 @@ void WatchHandler::loadTypeFormats()
     while (it.hasNext()) {
         it.next();
         if (!it.key().isEmpty())
-            m_typeFormats.insert(it.key(), it.value().toInt());
+            m_typeFormats.insert(it.key().toUtf8(), it.value().toInt());
     }
 }
 
 void WatchHandler::saveTypeFormats()
 {
     QMap<QString, QVariant> typeFormats;
-    QHashIterator<QString, int> it(m_typeFormats);
+    QHashIterator<QByteArray, int> it(m_typeFormats);
     while (it.hasNext()) {
         it.next();
         const int format = it.value();
@@ -1535,7 +1536,7 @@ WatchData *WatchHandler::findItem(const QByteArray &iname) const
     return model->findItem(iname, model->m_root);
 }
 
-void WatchHandler::setFormat(const QString &type, int format)
+void WatchHandler::setFormat(const QByteArray &type, int format)
 {
     if (format == -1)
         m_typeFormats.remove(type);
@@ -1580,10 +1581,10 @@ QByteArray WatchHandler::typeFormatRequests() const
 {
     QByteArray ba;
     if (!m_typeFormats.isEmpty()) {
-        QHashIterator<QString, int> it(m_typeFormats);
+        QHashIterator<QByteArray, int> it(m_typeFormats);
         while (it.hasNext()) {
             it.next();
-            ba.append(it.key().toLatin1().toHex());
+            ba.append(it.key().toHex());
             ba.append('=');
             ba.append(QByteArray::number(it.value()));
             ba.append(',');
@@ -1610,7 +1611,7 @@ QByteArray WatchHandler::individualFormatRequests() const
     return ba;
 }
 
-void WatchHandler::addTypeFormats(const QString &type, const QStringList &formats)
+void WatchHandler::addTypeFormats(const QByteArray &type, const QStringList &formats)
 {
     m_reportedTypeFormats.insert(type, formats);
 }
diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h
index 2206b72c1b362b680b21964c0cf44ef02efd482d..cada7520f312f92c4b3c5526ef0a7285ad53a656 100644
--- a/src/plugins/debugger/watchhandler.h
+++ b/src/plugins/debugger/watchhandler.h
@@ -119,7 +119,7 @@ signals:
     void enableUpdates(bool);
 
 private:
-    QString niceType(const QString &typeIn) const;
+    QByteArray niceType(const QByteArray &typeIn) const;
     void formatRequests(QByteArray *out, const WatchItem *item) const;
     DebuggerEngine *engine() const;
 
@@ -173,7 +173,7 @@ public:
 
     int format(const QByteArray &iname) const;
 
-    void addTypeFormats(const QString &type, const QStringList &formats);
+    void addTypeFormats(const QByteArray &type, const QStringList &formats);
 
     QByteArray watcherName(const QByteArray &exp);
 
@@ -185,7 +185,7 @@ private:
 
     void loadTypeFormats();
     void saveTypeFormats();
-    void setFormat(const QString &type, int format);
+    void setFormat(const QByteArray &type, int format);
     void updateWatchersWindow();
 
     bool m_inChange;
@@ -195,7 +195,7 @@ private:
     EditHandlers m_editHandlers;
 
     QHash<QByteArray, int> m_watcherNames;
-    QHash<QString, int> m_typeFormats;
+    QHash<QByteArray, int> m_typeFormats;
     QHash<QByteArray, int> m_individualFormats; // Indexed by iname.
     QHash<QString, QStringList> m_reportedTypeFormats;