Commit bb7a6f92 authored by Daniel Teske's avatar Daniel Teske Committed by hjk

TextEditor: Move setting up of encoding label to ctor

Task-number: QTCREATORBUG-9794
Change-Id: Ia01e71b67ed31f21234ee26c508149173d16c503
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent beef4807
......@@ -672,6 +672,14 @@ void TextEditorWidgetPrivate::ctor(const QSharedPointer<TextDocument> &doc)
static_cast<void (QWidget::*)()>(&QWidget::update));
m_moveLineUndoHack = false;
updateCannotDecodeInfo();
connect(m_fileEncodingLabel, &LineColumnLabel::clicked,
q, &TextEditorWidget::selectEncoding);
connect(m_document->document(), &QTextDocument::modificationChanged,
q, &TextEditorWidget::updateTextCodecLabel);
q->updateTextCodecLabel();
}
TextEditorWidget::~TextEditorWidget()
......@@ -963,13 +971,7 @@ bool TextEditorWidget::open(QString *errorString, const QString &fileName, const
if (d->m_document->open(errorString, fileName, realFileName)) {
moveCursor(QTextCursor::Start);
d->updateCannotDecodeInfo();
if (d->m_fileEncodingLabel) {
connect(d->m_fileEncodingLabel, &LineColumnLabel::clicked,
this, &TextEditorWidget::selectEncoding, Qt::UniqueConnection);
connect(d->m_document->document(), &QTextDocument::modificationChanged,
this, &TextEditorWidget::updateTextCodecLabel, Qt::UniqueConnection);
updateTextCodecLabel();
}
updateTextCodecLabel();
return true;
}
return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment