Commit 8e63d450 authored by Noah Davis's avatar Noah Davis 🌵
Browse files

Make renderDialGroove() area match the maximum renderDialContents() area

Summary: It bothered me that the groove for dials doesn't match the maximum area that the contents can use.

Test Plan:
Old: {F7366118, size=full}

New: {F7366127, size=full}

Reviewers: #vdg, #breeze, ngraham

Reviewed By: #vdg, #breeze, ngraham

Subscribers: ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D24008
parent 9b685d4b
......@@ -1052,7 +1052,8 @@ namespace Breeze
//______________________________________________________________________________
void Helper::renderDialGroove(
QPainter* painter, const QRect& rect,
const QColor& color ) const
const QColor& color,
qreal first, qreal last ) const
{
// setup painter
......@@ -1066,9 +1067,19 @@ namespace Breeze
const qreal penWidth( Metrics::Slider_GrooveThickness );
const QRectF grooveRect( rect.adjusted( penWidth/2, penWidth/2, -penWidth/2, -penWidth/2 ) );
painter->setPen( QPen( color, penWidth ) );
painter->setBrush( Qt::NoBrush );
painter->drawEllipse( grooveRect );
// setup angles
const int angleStart( first * 180 * 16 / M_PI );
const int angleSpan( (last - first ) * 180 * 16 / M_PI );
// setup pen
if( angleSpan != 0 )
{
QPen pen( color, penWidth );
pen.setCapStyle( Qt::RoundCap );
painter->setPen( pen );
painter->setBrush( Qt::NoBrush );
painter->drawArc( grooveRect, angleStart, angleSpan );
}
}
......
......@@ -216,7 +216,7 @@ namespace Breeze
void renderSliderHandle( QPainter*, const QRect&, const QColor&, const QColor& outline, const QColor& shadow, bool sunken ) const;
//* dial groove
void renderDialGroove( QPainter*, const QRect&, const QColor& ) const;
void renderDialGroove( QPainter*, const QRect&, const QColor&, qreal first, qreal last ) const;
//* dial groove
void renderDialContents( QPainter*, const QRect&, const QColor&, qreal first, qreal second ) const;
......
......@@ -6521,8 +6521,12 @@ namespace Breeze
// groove
const auto grooveColor( KColorUtils::mix( palette.color( QPalette::Window ), palette.color( QPalette::WindowText ), 0.3 ) );
// angles
const qreal first( dialAngle( sliderOption, sliderOption->minimum ) );
const qreal last( dialAngle( sliderOption, sliderOption->maximum ) );
// render groove
_helper->renderDialGroove( painter, grooveRect, grooveColor );
_helper->renderDialGroove( painter, grooveRect, grooveColor, first, last );
if( enabled )
{
......@@ -6531,7 +6535,6 @@ namespace Breeze
const auto highlight( palette.color( QPalette::Highlight ) );
// angles
const qreal first( dialAngle( sliderOption, sliderOption->minimum ) );
const qreal second( dialAngle( sliderOption, sliderOption->sliderPosition ) );
// render contents
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment