mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-17 11:30:49 +02:00
Trying a different rounding radius for the slide switch button.
This commit is contained in:
@@ -37,6 +37,7 @@ namespace {
|
|||||||
const qreal LEFT_THRESHOLD = 0.3;
|
const qreal LEFT_THRESHOLD = 0.3;
|
||||||
const qreal RIGHT_THRESHOLD = 0.7;
|
const qreal RIGHT_THRESHOLD = 0.7;
|
||||||
|
|
||||||
|
const int ROUNDING_RADIUS = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
SlideSwitchButton::SlideSwitchButton( QWidget* parent )
|
SlideSwitchButton::SlideSwitchButton( QWidget* parent )
|
||||||
@@ -182,7 +183,7 @@ SlideSwitchButton::paintEvent( QPaintEvent* event )
|
|||||||
|
|
||||||
QPainterPath borderPath;
|
QPainterPath borderPath;
|
||||||
const QRect borderRect = QRect( 0, 0, width(), height() );
|
const QRect borderRect = QRect( 0, 0, width(), height() );
|
||||||
borderPath.addRoundedRect( borderRect, 3, 3 );
|
borderPath.addRoundedRect( borderRect, ROUNDING_RADIUS, ROUNDING_RADIUS );
|
||||||
painter.fillPath( borderPath, gradient );
|
painter.fillPath( borderPath, gradient );
|
||||||
|
|
||||||
painter.drawPixmap( m_knobX * ( width() - m_knob.width() ), 0, m_knob );
|
painter.drawPixmap( m_knobX * ( width() - m_knob.width() ), 0, m_knob );
|
||||||
@@ -193,7 +194,7 @@ SlideSwitchButton::paintEvent( QPaintEvent* event )
|
|||||||
painter.setBrush( QBrush() );
|
painter.setBrush( QBrush() );
|
||||||
painter.setPen( palette.color( QPalette::Highlight ) );
|
painter.setPen( palette.color( QPalette::Highlight ) );
|
||||||
//TODO: should the whole thing be highlighted or just the knob?
|
//TODO: should the whole thing be highlighted or just the knob?
|
||||||
painter.drawRoundedRect( borderRect, 3, 3 );
|
painter.drawRoundedRect( borderRect, ROUNDING_RADIUS, ROUNDING_RADIUS );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -278,9 +279,5 @@ SlideSwitchButton::createKnob()
|
|||||||
p.setBrush( gradient );
|
p.setBrush( gradient );
|
||||||
p.setPen( QColor( 152, 152, 152 ) );
|
p.setPen( QColor( 152, 152, 152 ) );
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
p.drawRoundedRect( m_knob.rect(), ROUNDING_RADIUS-1, ROUNDING_RADIUS-1 );
|
||||||
p.drawRoundedRect( m_knob.rect(), 2, 2 );
|
|
||||||
#else
|
|
||||||
p.drawRoundedRect( m_knob.rect().adjusted( 1, 1, -1, -1 ), 2, 2 );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user