diff options
author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2009-12-17 11:46:55 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2009-12-17 11:50:27 +0100 |
commit | 41a737e6de4dcfed6c9b886294560e5248844ebe (patch) | |
tree | 0db8432503b7a82b412d5c4264028aa0acf59baa /src/plugins/texteditor/colorschemeedit.cpp | |
parent | 777071c944996b78790c9119067ef0892a89aca7 (diff) |
Fixed enabled state of erase background button in color scheme edit
Remember the read-only state so that it can be taken into account when
changing the enabled state of the erase background button.
Diffstat (limited to 'src/plugins/texteditor/colorschemeedit.cpp')
-rw-r--r-- | src/plugins/texteditor/colorschemeedit.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/texteditor/colorschemeedit.cpp b/src/plugins/texteditor/colorschemeedit.cpp index c47534e5a2..9f70d3154d 100644 --- a/src/plugins/texteditor/colorschemeedit.cpp +++ b/src/plugins/texteditor/colorschemeedit.cpp @@ -143,7 +143,8 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) : QWidget(parent), m_curItem(-1), m_ui(new Ui::ColorSchemeEdit), - m_formatsModel(new FormatsModel(this)) + m_formatsModel(new FormatsModel(this)), + m_readOnly(false) { m_ui->setupUi(this); m_ui->itemList->setModel(m_formatsModel); @@ -178,6 +179,11 @@ void ColorSchemeEdit::setBaseFont(const QFont &font) void ColorSchemeEdit::setReadOnly(bool readOnly) { + if (m_readOnly == readOnly) + return; + + m_readOnly = readOnly; + const bool enabled = !readOnly; m_ui->foregroundLabel->setEnabled(enabled); m_ui->foregroundToolButton->setEnabled(enabled); @@ -216,7 +222,9 @@ void ColorSchemeEdit::updateControls() m_ui->foregroundToolButton->setStyleSheet(colorButtonStyleSheet(format.foreground())); m_ui->backgroundToolButton->setStyleSheet(colorButtonStyleSheet(format.background())); - m_ui->eraseBackgroundToolButton->setEnabled(m_curItem > 0 && format.background().isValid()); + m_ui->eraseBackgroundToolButton->setEnabled(!m_readOnly + && m_curItem > 0 + && format.background().isValid()); const bool boldBlocked = m_ui->boldCheckBox->blockSignals(true); m_ui->boldCheckBox->setChecked(format.bold()); |