forked from qt-creator/qt-creator
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: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
(cherry picked from commit 754b8b3ac7
)
This commit is contained in:
committed by
Eike Ziller
parent
a5624a47a1
commit
a8b248f4ed
@@ -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;
|
||||
|
Reference in New Issue
Block a user