minor adjustments

This commit is contained in:
Uwe Rathmann 2021-08-27 09:45:24 +02:00
parent 01ea49fe02
commit 93987bd92f
2 changed files with 27 additions and 17 deletions

View File

@ -522,21 +522,32 @@ void Editor::setupSwitchButton()
setBoxShape( Q::Ripple, 100, Qt::RelativeSize ); setBoxShape( Q::Ripple, 100, Qt::RelativeSize );
setStrutSize( Q::Ripple, 2 * handleSize, 2 * handleSize ); setStrutSize( Q::Ripple, 2 * handleSize, 2 * handleSize );
setGradient( Q::Ripple, QColor(0,0,0,0) ); setGradient( Q::Ripple, QskRgb::Transparent );
setGradient( Q::Ripple | Q::Checked | Q::Hovered, for ( auto state : { Q::Hovered, Q::Focused, Q::Pressed } )
QColor(m_pal.accentColor.red(), m_pal.accentColor.green(), m_pal.accentColor.blue(), 50) ); {
setGradient( Q::Ripple | Q::Checked | Q::Focused, auto weak = m_pal.darker125;
QColor(m_pal.accentColor.red(), m_pal.accentColor.green(), m_pal.accentColor.blue(), 100) ); auto strong = m_pal.accentColor;
setGradient( Q::Ripple | Q::Checked | Q::Pressed,
QColor(m_pal.accentColor.red(), m_pal.accentColor.green(), m_pal.accentColor.blue(), 150) );
setGradient( Q::Ripple | Q::Hovered, if ( state == Q::Hovered )
QColor(m_pal.darker125.red(), m_pal.darker125.green(), m_pal.darker125.blue(), 100 ) ); {
setGradient( Q::Ripple | Q::Focused, weak.setAlpha( 100 );
QColor(m_pal.darker125.red(), m_pal.darker125.green(), m_pal.darker125.blue(), 150 ) ); strong.setAlpha( 50 );
setGradient( Q::Ripple | Q::Pressed, }
QColor(m_pal.darker125.red(), m_pal.darker125.green(), m_pal.darker125.blue(), 200) ); else if ( state == Q::Focused )
{
weak.setAlpha( 150 );
strong.setAlpha( 100 );
}
else
{
weak.setAlpha( 200 );
strong.setAlpha( 150 );
}
setGradient( Q::Ripple | state, weak );
setGradient( Q::Ripple | Q::Checked | state, strong );
}
for( auto state : { A::NoState, Q::Disabled } ) for( auto state : { A::NoState, Q::Disabled } )
{ {

View File

@ -3,9 +3,8 @@
* This file may be used under the terms of the QSkinny License, Version 1.0 * This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/ *****************************************************************************/
#include "QskSwitchButton.h"
#include "QskSwitchButtonSkinlet.h" #include "QskSwitchButtonSkinlet.h"
#include "QskSGNode.h" #include "QskSwitchButton.h"
static inline qreal qskEffectivePosition( const QskSwitchButton* switchButton ) static inline qreal qskEffectivePosition( const QskSwitchButton* switchButton )
{ {
@ -64,11 +63,11 @@ QSizeF QskSwitchButtonSkinlet::sizeHint( const QskSkinnable* skinnable,
if ( which != Qt::PreferredSize ) if ( which != Qt::PreferredSize )
return QSizeF(); return QSizeF();
auto groovehint = skinnable->strutSizeHint( QskSwitchButton::Groove ); auto grooveHint = skinnable->strutSizeHint( QskSwitchButton::Groove );
auto handleHint = skinnable->strutSizeHint( QskSwitchButton::Handle ); auto handleHint = skinnable->strutSizeHint( QskSwitchButton::Handle );
auto rippleHint = skinnable->strutSizeHint( QskSwitchButton::Ripple ); auto rippleHint = skinnable->strutSizeHint( QskSwitchButton::Ripple );
auto hint = groovehint.expandedTo( groovehint + rippleHint - handleHint ); auto hint = grooveHint.expandedTo( grooveHint + rippleHint - handleHint );
hint = hint.expandedTo( rippleHint ); hint = hint.expandedTo( rippleHint );
hint = hint.expandedTo( handleHint ); hint = hint.expandedTo( handleHint );