forked from qt-creator/qt-creator
QmlJSEditor: block non Utf8 codecs
Additionally adjust the postioning of the initial setCodec to all other forced codecs. Change-Id: Id60bfdac858851e5ad6554ff2dbcb3dd5b806c0b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -131,8 +131,6 @@ void QmlJSEditorWidget::finalizeInitialization()
|
||||
connect(&m_updateOutlineIndexTimer, &QTimer::timeout,
|
||||
this, &QmlJSEditorWidget::updateOutlineIndexNow);
|
||||
|
||||
textDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
||||
|
||||
m_modelManager = ModelManagerInterface::instance();
|
||||
m_contextPane = Internal::QmlJSEditorPlugin::quickToolBar();
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <utils/infobar.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTextCodec>
|
||||
|
||||
const char QML_UI_FILE_WARNING[] = "QmlJSEditor.QmlUiFileWarning";
|
||||
|
||||
@@ -655,9 +656,15 @@ QmlJSEditorDocument::QmlJSEditorDocument(Utils::Id id)
|
||||
connect(this, &TextEditor::TextDocument::tabSettingsChanged,
|
||||
d, &Internal::QmlJSEditorDocumentPrivate::invalidateFormatterCache);
|
||||
setSyntaxHighlighter(new QmlJSHighlighter(document()));
|
||||
setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
||||
setIndenter(new Internal::Indenter(document()));
|
||||
}
|
||||
|
||||
bool QmlJSEditorDocument::supportsCodec(const QTextCodec *codec) const
|
||||
{
|
||||
return codec == QTextCodec::codecForName("UTF-8");
|
||||
}
|
||||
|
||||
QmlJSEditorDocument::~QmlJSEditorDocument()
|
||||
{
|
||||
delete d;
|
||||
|
||||
@@ -46,6 +46,8 @@ public:
|
||||
QmlJSEditorDocument(Utils::Id id);
|
||||
~QmlJSEditorDocument() override;
|
||||
|
||||
bool supportsCodec(const QTextCodec *codec) const override;
|
||||
|
||||
const QmlJSTools::SemanticInfo &semanticInfo() const;
|
||||
bool isSemanticInfoOutdated() const;
|
||||
QVector<QTextLayout::FormatRange> diagnosticRanges() const;
|
||||
|
||||
Reference in New Issue
Block a user