Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
4226538a
Commit
4226538a
authored
Dec 20, 2010
by
mae
Browse files
Fix QML to UTF-8, unless changed in editor
Task-id: QTCREATORBUG-3424
parent
96475f95
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/session.cpp
View file @
4226538a
...
...
@@ -831,7 +831,7 @@ void SessionManager::setEditorCodec(Core::IEditor *editor, const QString &fileNa
if
(
TextEditor
::
ITextEditor
*
textEditor
=
qobject_cast
<
TextEditor
::
ITextEditor
*>
(
editor
))
if
(
Project
*
project
=
projectForFile
(
fileName
))
{
if
(
QTextCodec
*
codec
=
project
->
editorConfiguration
()
->
defaultTextCodec
())
textEditor
->
setTextCodec
(
codec
);
textEditor
->
setTextCodec
(
codec
,
TextEditor
::
ITextEditor
::
TextCodecFromProjectSetting
);
}
}
...
...
src/plugins/qmljseditor/qmljseditor.cpp
View file @
4226538a
...
...
@@ -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
>
();
...
...
src/plugins/qmljseditor/qmljseditoreditable.cpp
View file @
4226538a
...
...
@@ -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
src/plugins/qmljseditor/qmljseditoreditable.h
View file @
4226538a
...
...
@@ -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
;
...
...
src/plugins/texteditor/basetexteditor.h
View file @
4226538a
...
...
@@ -588,7 +588,7 @@ public:
void
setContextHelpId
(
const
QString
&
id
)
{
m_contextHelpId
=
id
;
}
QString
contextHelpId
()
const
;
// from IContext
inline
void
setTextCodec
(
QTextCodec
*
codec
)
{
e
->
setTextCodec
(
codec
);
}
inline
void
setTextCodec
(
QTextCodec
*
codec
,
TextCodecReason
=
TextCodecOtherReason
)
{
e
->
setTextCodec
(
codec
);
}
inline
QTextCodec
*
textCodec
()
const
{
return
e
->
textCodec
();
}
...
...
src/plugins/texteditor/itexteditor.h
View file @
4226538a
...
...
@@ -119,7 +119,13 @@ public:
virtual
void
setContextHelpId
(
const
QString
&
)
=
0
;
virtual
void
setTextCodec
(
QTextCodec
*
)
=
0
;
enum
TextCodecReason
{
TextCodecOtherReason
,
TextCodecFromSystemSetting
,
TextCodecFromProjectSetting
};
virtual
void
setTextCodec
(
QTextCodec
*
,
TextCodecReason
reason
=
TextCodecOtherReason
)
=
0
;
virtual
QTextCodec
*
textCodec
()
const
=
0
;
static
QMap
<
QString
,
QString
>
openedTextEditorsContents
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment