From 4db79f2cbe4ad6da3ea3f3555e017c3eae1e49f7 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig <jens.bache-wiig@nokia.com> Date: Fri, 29 May 2009 16:50:38 +0200 Subject: [PATCH] Fixes: Fix mac problems in collapse highlight --- src/plugins/texteditor/basetexteditor.cpp | 30 ++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 97f541aff30..b2e06c67fac 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2258,24 +2258,24 @@ static void drawRectBox(QPainter *painter, const QRect &rect, bool start, bool e painter->save(); painter->setRenderHint(QPainter::Antialiasing, false); QColor c = pal.highlight().color(); - c.setAlpha(36); + c.setAlpha(40); QLinearGradient grad(rect.topLeft(), rect.topRight()); grad.setColorAt(0, c.darker(130)); - grad.setColorAt(1, c.lighter(150)); + grad.setColorAt(1, c.lighter(160)); QColor outline = c.darker(110); outline.setAlpha(100); + QRect r = rect; + + painter->fillRect(rect, grad); painter->setPen(outline); - QRect r = rect.adjusted(0, 0, 0, -1); - painter->setBrush(grad); - painter->save(); - painter->setClipRect(rect.adjusted(0, 0, -1, 0)); - if (!start) - r.adjust(0,-3, 0 ,0); - if (!end) - r.adjust(0, 0, 0, 3); - painter->drawRoundedRect(r, 3, 3); - painter->restore(); - painter->drawLine(rect.topRight(), rect.bottomRight()); + if (start) + painter->drawLine(rect.topLeft() + QPoint(1, 0), rect.topRight() - QPoint(1, 0)); + if (end) + painter->drawLine(rect.bottomLeft() + QPoint(1, 0), rect.bottomRight() - QPoint(1, 0)); + + painter->drawLine(rect.topRight() + QPoint(0, start ? 1 : 0), rect.bottomRight() - QPoint(0, end ? 1 : 0)); + painter->drawLine(rect.topLeft() + QPoint(0, start ? 1 : 0), rect.bottomLeft() - QPoint(0, end ? 1 : 0)); + painter->restore(); } @@ -2488,10 +2488,12 @@ void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QPalette &pal, s = ms->systemStyle(); // QGtkStyle needs a small correction to draw the marker in the right place - if (qstrcmp(s->metaObject()->className(), "QGtkStyle") == 0) + if (!qstrcmp(s->metaObject()->className(), "QGtkStyle") == 0 || + !qstrcmp(s->metaObject()->className(), "QMacStyle") == 0) opt.rect.translate(-2, 0); s->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this); + } void BaseTextEditor::slotModificationChanged(bool m) -- GitLab