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:
Eike Ziller
2019-07-18 16:19:33 +02:00
parent bc6628d037
commit 59e2774d0d
8 changed files with 83 additions and 35 deletions

View File

@@ -43,7 +43,7 @@ class QMLJSEDITOR_EXPORT QmlJSEditorDocument : public TextEditor::TextDocument
{
Q_OBJECT
public:
QmlJSEditorDocument();
QmlJSEditorDocument(Core::Id id);
~QmlJSEditorDocument() override;
const QmlJSTools::SemanticInfo &semanticInfo() const;
@@ -54,6 +54,9 @@ public:
TextEditor::IAssistProvider *quickFixAssistProvider() const override;
void setIsDesignModePreferred(bool value);
bool isDesignModePreferred() const;
signals:
void updateCodeWarnings(QmlJS::Document::Ptr doc);
void semanticInfoUpdated(const QmlJSTools::SemanticInfo &semanticInfo);