forked from qt-creator/qt-creator
Fix QML to UTF-8, unless changed in editor
Task-id: QTCREATORBUG-3424
This commit is contained in:
@@ -659,6 +659,7 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
|
||||
connect(m_cursorPositionTimer, SIGNAL(timeout()), this, SLOT(updateCursorPositionNow()));
|
||||
|
||||
baseTextDocument()->setSyntaxHighlighter(new Highlighter(document()));
|
||||
baseTextDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
||||
|
||||
m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<ModelManagerInterface>();
|
||||
m_contextPane = ExtensionSystem::PluginManager::instance()->getObject<QmlJS::IContextPane>();
|
||||
|
||||
@@ -93,4 +93,11 @@ QString QmlJSEditorEditable::preferredModeType() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
void QmlJSEditorEditable::setTextCodec(QTextCodec *codec, TextCodecReason reason)
|
||||
{
|
||||
if (reason != TextCodecOtherReason) // qml is defined to be utf8
|
||||
return;
|
||||
editor()->setTextCodec(codec);
|
||||
}
|
||||
|
||||
} // namespace QmlJSEditor
|
||||
|
||||
@@ -54,6 +54,8 @@ public:
|
||||
bool isTemporary() const { return false; }
|
||||
virtual bool open(const QString & fileName);
|
||||
virtual QString preferredModeType() const;
|
||||
void setTextCodec(QTextCodec *codec, TextCodecReason = TextCodecOtherReason);
|
||||
|
||||
|
||||
private:
|
||||
Core::Context m_context;
|
||||
|
||||
Reference in New Issue
Block a user