Commit 75e408be authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: Warn if QML file is opened in Plain Text Editor

If a QML file is opened with the Plain Text Editor,
the design mode cannot work and is not properly activated.

With this patch we warn about this and go back to the edit mode.

Change-Id: I4dc9dd957cb8f704e59563a82d4dbf31cb8307e9
Reviewed-by: default avatarTim Jenssen <>
parent ec05dfe9
......@@ -47,6 +47,7 @@
#include <coreplugin/designmode.h>
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
#include <coreplugin/messagebox.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginspec.h>
......@@ -99,6 +100,12 @@ static bool checkIfEditorIsQtQuick(Core::IEditor *editor)
|| document->language() == QmlJS::Dialect::Qml;
if (Core::ModeManager::currentMode() == Core::Constants::MODE_DESIGN) {
Core::AsynchronousMessageBox::warning(QmlDesignerPlugin::tr("Cannot open QML Design Mode"),
QmlDesignerPlugin::tr("The QML file is not currently opened in a QML Editor."));
return false;
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