diff --git a/share/qtcreator/qml/qmljsdebugger/protocol/observerprotocol.h b/share/qtcreator/qml/qmljsdebugger/protocol/observerprotocol.h
index 27d3ad70b2bfc5295c837ceef43cfae966646394..f5dd5b84a1873038924d38d830267e3971448fa7 100644
--- a/share/qtcreator/qml/qmljsdebugger/protocol/observerprotocol.h
+++ b/share/qtcreator/qml/qmljsdebugger/protocol/observerprotocol.h
@@ -77,12 +77,12 @@ public:
 
     static inline QString toString(Message message)
     {
-        return staticMetaObject.enumerator(0).key(message);
+        return staticMetaObject.enumerator(0).valueToKey(message);
     }
 
     static inline QString toString(Tool tool)
     {
-        return staticMetaObject.enumerator(1).key(tool);
+        return staticMetaObject.enumerator(1).valueToKey(tool);
     }
 };