diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index d32c566d65a..07e8a370427 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2433,7 +2433,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) TextEditorOverlay *overlay = new TextEditorOverlay(this); overlay->addOverlaySelection(d->m_findScopeStart.position(), d->m_findScopeEnd.position(), - d->m_searchScopeFormat.background().color().darker(120), + d->m_searchScopeFormat.foreground().color(), d->m_searchScopeFormat.background().color(), TextEditorOverlay::ExpandBegin); overlay->setAlpha(false); @@ -2525,7 +2525,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) } painter.fillRect(rr, d->m_searchScopeFormat.background()); - QColor lineCol = d->m_searchScopeFormat.background().color().darker(120); + QColor lineCol = d->m_searchScopeFormat.foreground().color(); QPen pen = painter.pen(); painter.setPen(lineCol); if (blockFS == d->m_findScopeStart.block()) @@ -5078,7 +5078,9 @@ void BaseTextEditor::setFontSettings(const TextEditor::FontSettings &fs) p.setColor(QPalette::Highlight, (selectionFormat.background().style() != Qt::NoBrush) ? selectionFormat.background().color() : QApplication::palette().color(QPalette::Highlight)); - p.setColor(QPalette::HighlightedText, selectionFormat.foreground().color()); + + p.setBrush(QPalette::HighlightedText, selectionFormat.foreground()); + p.setBrush(QPalette::Inactive, QPalette::Highlight, p.highlight()); p.setBrush(QPalette::Inactive, QPalette::HighlightedText, p.highlightedText()); setPalette(p); diff --git a/src/plugins/texteditor/colorschemeedit.cpp b/src/plugins/texteditor/colorschemeedit.cpp index 03141bd5837..747f6869e6e 100644 --- a/src/plugins/texteditor/colorschemeedit.cpp +++ b/src/plugins/texteditor/colorschemeedit.cpp @@ -156,6 +156,7 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) : connect(m_ui->foregroundToolButton, SIGNAL(clicked()), SLOT(changeForeColor())); connect(m_ui->backgroundToolButton, SIGNAL(clicked()), SLOT(changeBackColor())); connect(m_ui->eraseBackgroundToolButton, SIGNAL(clicked()), SLOT(eraseBackColor())); + connect(m_ui->eraseForegroundToolButton, SIGNAL(clicked()), SLOT(eraseForeColor())); connect(m_ui->boldCheckBox, SIGNAL(toggled(bool)), SLOT(checkCheckBoxes())); connect(m_ui->italicCheckBox, SIGNAL(toggled(bool)), SLOT(checkCheckBoxes())); } @@ -192,6 +193,7 @@ void ColorSchemeEdit::setReadOnly(bool readOnly) m_ui->backgroundLabel->setEnabled(enabled); m_ui->backgroundToolButton->setEnabled(enabled); m_ui->eraseBackgroundToolButton->setEnabled(enabled); + m_ui->eraseForegroundToolButton->setEnabled(enabled); m_ui->boldCheckBox->setEnabled(enabled); m_ui->italicCheckBox->setEnabled(enabled); } @@ -227,6 +229,9 @@ void ColorSchemeEdit::updateControls() m_ui->eraseBackgroundToolButton->setEnabled(!m_readOnly && m_curItem > 0 && format.background().isValid()); + m_ui->eraseForegroundToolButton->setEnabled(!m_readOnly + && m_curItem > 0 + && format.foreground().isValid()); const bool boldBlocked = m_ui->boldCheckBox->blockSignals(true); m_ui->boldCheckBox->setChecked(format.bold()); @@ -247,6 +252,7 @@ void ColorSchemeEdit::changeForeColor() QPalette p = m_ui->foregroundToolButton->palette(); p.setColor(QPalette::Active, QPalette::Button, newColor); m_ui->foregroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor)); + m_ui->eraseForegroundToolButton->setEnabled(true); foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) { const QString category = m_descriptions[index.row()].id(); @@ -291,6 +297,21 @@ void ColorSchemeEdit::eraseBackColor() } } +void ColorSchemeEdit::eraseForeColor() +{ + if (m_curItem == -1) + return; + QColor newColor; + m_ui->foregroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor)); + m_ui->eraseForegroundToolButton->setEnabled(false); + + foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) { + const QString category = m_descriptions[index.row()].id(); + m_scheme.formatFor(category).setForeground(newColor); + m_formatsModel->emitDataChanged(index); + } +} + void ColorSchemeEdit::checkCheckBoxes() { if (m_curItem == -1) diff --git a/src/plugins/texteditor/colorschemeedit.h b/src/plugins/texteditor/colorschemeedit.h index f346ddae1bd..631a5973006 100644 --- a/src/plugins/texteditor/colorschemeedit.h +++ b/src/plugins/texteditor/colorschemeedit.h @@ -71,6 +71,7 @@ private slots: void changeForeColor(); void changeBackColor(); void eraseBackColor(); + void eraseForeColor(); void checkCheckBoxes(); private: diff --git a/src/plugins/texteditor/colorschemeedit.ui b/src/plugins/texteditor/colorschemeedit.ui index d9f342d439c..65af997edeb 100644 --- a/src/plugins/texteditor/colorschemeedit.ui +++ b/src/plugins/texteditor/colorschemeedit.ui @@ -10,17 +10,8 @@ 210 - - - 0 - - - 0 - - - 0 - - + + @@ -36,23 +27,25 @@ - - - - - - Bold - - - - - - - Italic - - - - + + + + + 0 + 0 + + + + Foreground: + + + foregroundToolButton + + + + + + @@ -65,88 +58,98 @@ - - - - - 0 - 0 - + + + + Erase foreground - Background: + x - - backgroundToolButton + + Qt::LeftArrow - - - - - 0 - 0 - - - - Foreground: - - - foregroundToolButton - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - 0 - 0 - - - - - - - - - - - Erase background - - - x - - - Qt::LeftArrow - - - - - + + + + + 0 + 0 + + + + Background: + + + backgroundToolButton + + + + + + + + + + 0 + 0 + + + + + + + + + + + Erase background + + + x + + + Qt::LeftArrow + + + + + + + + + Bold + + + + + + + Italic + + + + + + + Qt::Vertical + + + + 20 + 83 + + + + itemList - foregroundToolButton backgroundToolButton eraseBackgroundToolButton boldCheckBox