forked from qt-creator/qt-creator
Qt Quick: Separate Qt Quick Designer and QMLJS editor factories
Currently the QmlJSEditorFactory hardcodes that .qml.ui files are opened "in Design mode", without any option to explicitly open them directly in text mode. While this is the preferred way of working, there are always exceptions. Separate the "Edit mode by default" and the "Design mode by default" parts into separate editor factories. The former one is the default editor for .qml files, the latter for .qml.ui files. This allows users to explicitly choose "Open With > QML JS Editor" to open .qml.ui files directly in Edit mode. Fixes: QTCREATORBUG-18123 Change-Id: I72ab2d25fdc538210123782f6611f9c6e3157dea Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -141,10 +141,12 @@ QmlJSEditorPluginPrivate::QmlJSEditorPluginPrivate()
|
||||
// recompute messages when project data changes (files added or removed)
|
||||
connect(modelManager, &QmlJS::ModelManagerInterface::projectInfoUpdated,
|
||||
&m_qmlTaskManager, &QmlTaskManager::updateMessages);
|
||||
connect(modelManager, &QmlJS::ModelManagerInterface::aboutToRemoveFiles,
|
||||
&m_qmlTaskManager, &QmlTaskManager::documentsRemoved);
|
||||
connect(modelManager,
|
||||
&QmlJS::ModelManagerInterface::aboutToRemoveFiles,
|
||||
&m_qmlTaskManager,
|
||||
&QmlTaskManager::documentsRemoved);
|
||||
|
||||
Context context(Constants::C_QMLJSEDITOR_ID);
|
||||
Context context(Constants::C_QMLJSEDITOR_ID, Constants::C_QTQUICKDESIGNEREDITOR_ID);
|
||||
|
||||
ActionContainer *contextMenu = ActionManager::createMenu(Constants::M_CONTEXT);
|
||||
ActionContainer *qmlToolsMenu = ActionManager::actionContainer(Id(QmlJSTools::Constants::M_TOOLS_QMLJS));
|
||||
@@ -352,7 +354,8 @@ void QmlJSEditorPluginPrivate::autoFormatOnSave(IDocument *document)
|
||||
return;
|
||||
|
||||
// Check that we are dealing with a QML/JS editor
|
||||
if (document->id() != Constants::C_QMLJSEDITOR_ID)
|
||||
if (document->id() != Constants::C_QMLJSEDITOR_ID
|
||||
&& document->id() != Constants::C_QTQUICKDESIGNEREDITOR_ID)
|
||||
return;
|
||||
|
||||
// Check if file is contained in the current project (if wished)
|
||||
|
||||
Reference in New Issue
Block a user