Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
fixed #54 highlight lines will now gracefully fade away if the window…
Browse files Browse the repository at this point in the history
… has no sideborders to draw the line on
  • Loading branch information
n4n0GH committed Jan 4, 2020
1 parent b66e4ce commit 19a204a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion window-decoration/kdecoration/hellodecoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,14 +636,24 @@ namespace Hello
// TODO: make this behave like the size grip which is drawn above any
// content inside the window frame
if( drawHighlight() ){
const QRect titleRect(QPoint(0, 0), QSize(size().width(), borderTop()));
const QColor titleBarColor = ( this->titleBarColor() );
const QRect windowRect(
QPoint(0, 0),
QSize( size().width(), size().height() ) );
QLinearGradient gradient( 0, 0, 0, titleRect.height() );
gradient.setColorAt(0.0, titleBarColor.lighter(200));
gradient.setColorAt(0.7, titleBarColor);
auto g = QPen ( gradient, 1.0 );
QColor sharpColor = titleBarColor.lighter(200);
sharpColor.setAlpha(102);
painter->setBrush( Qt::NoBrush );
painter->setPen( sharpColor );
// check if window has side borders or no borders at all and use a smooth gradient if no border to draw the highlight on is present
if( hasNoSideBorders() || hasNoBorders() ){
painter->setPen( g );
} else {
painter->setPen( sharpColor );
}
painter->drawRoundedRect(windowRect, customRadius(), customRadius());
}
}
Expand Down

0 comments on commit 19a204a

Please sign in to comment.