diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-12-17 14:38:49 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-12-18 06:42:10 +0000 |
commit | 6d4223c5d61fd42144cd1361e76c874c6384049b (patch) | |
tree | ab279594ab31e9d310a038fa4524856ca42a7489 | |
parent | ba7545f2ff33245ff72d576abd243bb2d786f191 (diff) | |
download | qt-creator-6d4223c5d61fd42144cd1361e76c874c6384049b.tar.gz |
Do not show line ending option in read-only editors
This avoids showing the option for example in git log or blame views.
The user also should not be able to actually change the line ending
style of read-only editors.
Fixes: QTCREATORBUG-23276
Change-Id: Ifa5cc9f663539928b4d5422b020e348b439684fa
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Marius Sincovici <smaryus@gmail.com>
-rw-r--r-- | src/plugins/texteditor/texteditor.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 2d349cecb7..ac84aca67c 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -833,6 +833,10 @@ TextEditorWidgetPrivate::TextEditorWidgetPrivate(TextEditorWidget *parent) m_fileLineEnding->addItems(ExtraEncodingSettings::lineTerminationModeNames()); m_fileLineEnding->setContentsMargins(spacing, 0, spacing, 0); m_fileLineEndingAction = m_toolBar->addWidget(m_fileLineEnding); + m_fileLineEndingAction->setVisible(!q->isReadOnly()); + connect(q, &TextEditorWidget::readOnlyChanged, this, [this] { + m_fileLineEndingAction->setVisible(!q->isReadOnly()); + }); m_fileEncodingLabel = new FixedSizeClickLabel; m_fileEncodingLabel->setContentsMargins(spacing, 0, spacing, 0); |