[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kate] part/view: folding highlight: draw a decent linear gradient
From: Dominik Haumann <dhdev () gmx ! de>
Date: 2011-09-11 9:48:05
Message-ID: 20110911094805.60463A607A () git ! kde ! org
[Download RAW message or body]
Git commit 1529910b966c66116eb79d1b41b6ac6d9ec68631 by Dominik Haumann.
Committed on 11/09/2011 at 11:45.
Pushed by dhaumann into branch 'master'.
folding highlight: draw a decent linear gradient
M +27 -7 part/view/kateviewhelpers.cpp
http://commits.kde.org/kate/1529910b966c66116eb79d1b41b6ac6d9ec68631
diff --git a/part/view/kateviewhelpers.cpp b/part/view/kateviewhelpers.cpp
index 1d7337a..131b6fd 100644
--- a/part/view/kateviewhelpers.cpp
+++ b/part/view/kateviewhelpers.cpp
@@ -71,6 +71,7 @@
#include <QtGui/QToolTip>
#include <QtGui/QAction>
#include <QtGui/QWhatsThis>
+#include <QtGui/QLinearGradient>
#include <math.h>
@@ -1200,13 +1201,32 @@ void KateIconBorder::paintBorder (int /*x*/, int y, int /*width*/, int height)
KateLineInfo info;
m_doc->lineInfo(&info,realLine);
- /**
- * background with possible additional folding highlighting
- */
- QBrush currentFoldingColor = m_view->renderer()->config()->iconBarColor();
- if (m_foldingRange && m_foldingRange->overlapsLine (realLine))
- currentFoldingColor = m_foldingHighlightColor;
- p.fillRect(lnX, y, iconPaneWidth, h, currentFoldingColor);
+ // first icon border background
+ p.fillRect(lnX, y, iconPaneWidth, h, m_view->renderer()->config()->iconBarColor());
+ // ... with possible additional folding highlighting
+ if (m_foldingRange && m_foldingRange->overlapsLine (realLine)) {
+ p.save();
+ p.setClipRect(lnX, y, lnX+iconPaneWidth, y+h);
+ p.setRenderHint(QPainter::Antialiasing);
+
+ // use linear gradient as brush
+ QLinearGradient g(lnX, y, lnX + iconPaneWidth, y);
+ g.setColorAt(0, m_foldingHighlightColor);
+ g.setColorAt(0.3, m_foldingHighlightColor.lighter(125));
+ g.setColorAt(1, m_foldingHighlightColor);
+ p.setBrush(g);
+ p.setPen(m_foldingHighlightColor.lighter());
+
+ const qreal r = iconPaneWidth / 4.0;
+ if (m_foldingRange->start().line() == realLine) {
+ p.drawRoundedRect(lnX, y, iconPaneWidth, h + r, r, r);
+ } else if (m_foldingRange->end().line() == realLine) {
+ p.drawRoundedRect(lnX, y-r, iconPaneWidth, h + r, r, r);
+ } else {
+ p.drawRect(lnX, y-r, iconPaneWidth, h+2*r);
+ }
+ p.restore();
+ }
if (!info.topLevel)
{
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic