Skip to content
Snippets Groups Projects
Commit a8b248f4 authored by Leandro Melo's avatar Leandro Melo Committed by Eike Ziller
Browse files

Editors: Dont configure form's text editor unnecessarily

It's sufficient (and actually better) to configure the plain
text editor at the moment in which the xml is synchronized.

Task-number: QTCREATORBUG-5251
Change-Id: Ib2a3e1828f61770871486b8fbc1618abda1a5a74
Reviewed-on: http://codereview.qt.nokia.com/931


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
(cherry picked from commit 754b8b3a)
parent a5624a47
No related branches found
No related tags found
No related merge requests found
......@@ -88,7 +88,6 @@ FormWindowEditor::FormWindowEditor(Internal::DesignerXmlEditor *editor,
// Force update of open editors model.
connect(&d->m_file, SIGNAL(saved()), this, SIGNAL(changed()));
connect(&d->m_file, SIGNAL(changed()), this, SIGNAL(changed()));
connect(this, SIGNAL(changed()), this, SLOT(configureXmlEditor()));
}
FormWindowEditor::~FormWindowEditor()
......@@ -196,19 +195,12 @@ void FormWindowEditor::syncXmlEditor()
syncXmlEditor(contents());
}
void FormWindowEditor::configureXmlEditor() const
{
TextEditor::PlainTextEditorWidget *widget =
qobject_cast<TextEditor::PlainTextEditorWidget *>(d->m_textEditor.widget());
if (widget)
widget->configure(Core::ICore::instance()->mimeDatabase()->findByFile(
d->m_file.fileName()));
}
void FormWindowEditor::syncXmlEditor(const QString &contents)
{
d->m_textEditor.editorWidget()->setPlainText(contents);
d->m_textEditor.editorWidget()->setReadOnly(true);
static_cast<TextEditor::PlainTextEditorWidget *>
(d->m_textEditor.editorWidget())->configure(file()->mimeType());
}
Core::IFile *FormWindowEditor::file()
......
......@@ -97,7 +97,6 @@ public:
public slots:
void syncXmlEditor();
void configureXmlEditor() const;
private slots:
void slotOpen(QString *errorString, const QString &fileName);
......
......@@ -154,6 +154,11 @@ void PlainTextEditorWidget::configure()
configure(mimeType);
}
void PlainTextEditorWidget::configure(const QString &mimeType)
{
configure(Core::ICore::instance()->mimeDatabase()->findByType(mimeType));
}
void PlainTextEditorWidget::configure(const Core::MimeType &mimeType)
{
Highlighter *highlighter = new Highlighter();
......
......@@ -68,6 +68,7 @@ class TEXTEDITOR_EXPORT PlainTextEditorWidget : public BaseTextEditorWidget
public:
PlainTextEditorWidget(QWidget *parent);
void configure(const QString& mimeType);
void configure(const Core::MimeType &mimeType);
bool isMissingSyntaxDefinition() const;
bool ignoreMissingSyntaxDefinition() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment