TextEditor: Move setting up of encoding label to ctor

Task-number: QTCREATORBUG-9794
Change-Id: Ia01e71b67ed31f21234ee26c508149173d16c503
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Daniel Teske
2014-09-30 15:38:31 +02:00
committed by hjk
parent beef480783
commit bb7a6f923c

View File

@@ -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;