Don't clip the right margin indication

Doesn't look right, since it causes some background to show through
between the indicator and the scrollbar.
This commit is contained in:
Thorbjørn Lindeijer
2008-12-09 12:10:26 +01:00
parent 9cdbb1527b
commit 756de96d99

View File

@@ -1635,6 +1635,20 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
QRect er = e->rect();
QRect viewportRect = viewport()->rect();
const QColor baseColor = palette().base().color();
const int blendBase = (baseColor.value() > 128) ? 0 : 255;
// Darker backgrounds may need a bit more contrast
// (this calculation is temporary solution until we have a setting for this color)
const int blendFactor = (baseColor.value() > 128) ? 8 : 16;
const QColor blendColor(
(blendBase * blendFactor + baseColor.blue() * (256 - blendFactor)) / 256,
(blendBase * blendFactor + baseColor.green() * (256 - blendFactor)) / 256,
(blendBase * blendFactor + baseColor.blue() * (256 - blendFactor)) / 256);
if (d->m_visibleWrapColumn > 0) {
qreal lineX = fontMetrics().averageCharWidth() * d->m_visibleWrapColumn + offset.x() + 4;
painter.fillRect(QRectF(lineX, 0, viewportRect.width() - lineX, viewportRect.height()), blendColor);
}
// keep right margin clean from full-width selection
int maxX = offset.x() + qMax((qreal)viewportRect.width(), documentLayout->documentSize().width())
- doc->documentMargin();
@@ -1647,7 +1661,6 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
QAbstractTextDocumentLayout::PaintContext context = getPaintContext();
if (!d->m_findScope.isNull()) {
QAbstractTextDocumentLayout::Selection selection;
selection.format.setBackground(d->m_searchScopeFormat.background());
@@ -1672,20 +1685,6 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
blockSelection->lastColumn = qMax(columnA, columnB) + d->m_blockSelectionExtraX;
}
const QColor baseColor = palette().base().color();
const int blendBase = (baseColor.value() > 128) ? 0 : 255;
// Darker backgrounds may need a bit more contrast
// (this calculation is temporary solution until we have a setting for this color)
const int blendFactor = (baseColor.value() > 128) ? 8 : 16;
const QColor blendColor(
(blendBase * blendFactor + baseColor.blue() * (256 - blendFactor)) / 256,
(blendBase * blendFactor + baseColor.green() * (256 - blendFactor)) / 256,
(blendBase * blendFactor + baseColor.blue() * (256 - blendFactor)) / 256);
if (d->m_visibleWrapColumn > 0) {
qreal lineX = fontMetrics().averageCharWidth() * d->m_visibleWrapColumn + offset.x() + 4;
painter.fillRect(QRectF(lineX, 0, viewportRect.width() - lineX, viewportRect.height()), blendColor);
}
QTextBlock visibleCollapsedBlock;
QPointF visibleCollapsedBlockOffset;