windows style: Style checkboxes
This commit is contained in:
parent
f7ea02f2ad
commit
9752cf9e57
|
@ -171,6 +171,48 @@ void Editor::setupBox()
|
|||
|
||||
void Editor::setupCheckBox()
|
||||
{
|
||||
using Q = QskCheckBox;
|
||||
|
||||
setStrutSize( Q::Panel, 126, 38 );
|
||||
setSpacing( Q::Panel, 8 );
|
||||
|
||||
setStrutSize( Q::Box, { 20, 20 } ); // 18 + 2*1 border
|
||||
setBoxShape( Q::Box, 4 ); // adapt to us taking the border into account
|
||||
setBoxBorderMetrics( Q::Box, 1 );
|
||||
setPadding( Q::Box, 5 ); // "icon size"
|
||||
|
||||
setGradient( Q::Box, theme.palette.fillColor.controlAlt.secondary );
|
||||
setBoxBorderColors( Q::Box, theme.palette.strokeColor.controlStrongStroke.defaultColor );
|
||||
|
||||
setGradient( Q::Box | Q::Checked, theme.palette.fillColor.accent.defaultColor );
|
||||
setBoxBorderColors( Q::Box | Q::Checked, theme.palette.fillColor.accent.defaultColor );
|
||||
|
||||
const auto checkMark = symbol( "checkmark" );
|
||||
setSymbol( Q::Indicator | Q::Checked, checkMark, { QskStateCombination::CombinationNoState, Q::Disabled } );
|
||||
setGraphicRole( Q::Indicator, QskWindowsSkin::GraphicRoleFillColorTextOnAccentPrimary );
|
||||
|
||||
setFontRole( Q::Text, QskWindowsSkin::Body );
|
||||
setColor( Q::Text, theme.palette.fillColor.text.primary );
|
||||
|
||||
|
||||
setGradient( Q::Box | Q::Hovered, theme.palette.fillColor.controlAlt.tertiary );
|
||||
setBoxBorderColors( Q::Box | Q::Hovered, theme.palette.strokeColor.controlStrongStroke.defaultColor );
|
||||
setGradient( Q::Box | Q::Hovered | Q::Checked, theme.palette.fillColor.accent.secondary );
|
||||
setBoxBorderColors( Q::Box | Q::Hovered | Q::Checked, theme.palette.fillColor.accent.secondary );
|
||||
// indicator the same as in Rest state
|
||||
|
||||
setGradient( Q::Box | Q::Pressed, theme.palette.fillColor.controlAlt.quaternary );
|
||||
setBoxBorderColors( Q::Box | Q::Pressed, theme.palette.strokeColor.controlStrongStroke.disabled );
|
||||
setGradient( Q::Box | Q::Pressed | Q::Checked, theme.palette.fillColor.accent.tertiary );
|
||||
setBoxBorderColors( Q::Box | Q::Pressed | Q::Checked, theme.palette.fillColor.accent.tertiary );
|
||||
setGraphicRole( Q::Indicator | Q::Pressed | Q::Checked, QskWindowsSkin::GraphicRoleFillColorTextOnAccentSecondary );
|
||||
|
||||
setGradient( Q::Box | Q::Disabled, theme.palette.fillColor.controlAlt.disabled );
|
||||
setBoxBorderColors( Q::Box | Q::Disabled, theme.palette.strokeColor.controlStrongStroke.disabled );
|
||||
setGradient( Q::Box | Q::Disabled | Q::Checked, theme.palette.fillColor.accent.disabled );
|
||||
setBoxBorderColors( Q::Box | Q::Disabled | Q::Checked, theme.palette.fillColor.accent.disabled );
|
||||
setGraphicRole( Q::Indicator | Q::Disabled | Q::Checked, QskWindowsSkin::GraphicRoleFillColorTextOnAccentDisabled );
|
||||
setColor( Q::Text | Q::Disabled, theme.palette.fillColor.text.disabled );
|
||||
}
|
||||
|
||||
void Editor::setupComboBox()
|
||||
|
@ -762,21 +804,16 @@ void QskWindowsSkin::setGraphicColor( GraphicRole role, QRgb rgb )
|
|||
{
|
||||
QskColorFilter colorFilter;
|
||||
colorFilter.setMask( QskRgb::RGBAMask );
|
||||
colorFilter.addColorSubstitution( QskRgb::Black, rgb );
|
||||
colorFilter.addColorSubstitution( QskRgb::White, rgb );
|
||||
|
||||
setGraphicFilter( role, colorFilter );
|
||||
}
|
||||
|
||||
void QskWindowsSkin::setupGraphicFilters( const QskWindowsTheme& theme )
|
||||
{
|
||||
// setGraphicColor( GraphicRoleOnPrimary, palette.onPrimary );
|
||||
// setGraphicColor( GraphicRoleOnSecondaryContainer, palette.onSecondaryContainer );
|
||||
// setGraphicColor( GraphicRoleOnError, palette.onError );
|
||||
// setGraphicColor( GraphicRoleOnSurface, palette.onSurface );
|
||||
// setGraphicColor( GraphicRoleOnSurface38, palette.onSurface38 );
|
||||
// setGraphicColor( GraphicRoleOnSurfaceVariant, palette.onSurfaceVariant );
|
||||
// setGraphicColor( GraphicRolePrimary, palette.primary );
|
||||
// setGraphicColor( GraphicRoleSurface, palette.surface );
|
||||
setGraphicColor( GraphicRoleFillColorTextOnAccentDisabled, theme.palette.fillColor.textOnAccent.disabled );
|
||||
setGraphicColor( GraphicRoleFillColorTextOnAccentPrimary, theme.palette.fillColor.textOnAccent.primary );
|
||||
setGraphicColor( GraphicRoleFillColorTextOnAccentSecondary, theme.palette.fillColor.textOnAccent.secondary );
|
||||
}
|
||||
|
||||
#include "moc_QskWindowsSkin.cpp"
|
||||
|
|
|
@ -326,14 +326,9 @@ class QSK_WINDOWS_EXPORT QskWindowsSkin : public QskSkin
|
|||
|
||||
enum GraphicRole
|
||||
{
|
||||
GraphicRoleOnError,
|
||||
GraphicRoleOnPrimary,
|
||||
GraphicRoleOnSecondaryContainer,
|
||||
GraphicRoleOnSurface,
|
||||
GraphicRoleOnSurface38,
|
||||
GraphicRoleOnSurfaceVariant,
|
||||
GraphicRolePrimary,
|
||||
GraphicRoleSurface,
|
||||
GraphicRoleFillColorTextOnAccentDisabled,
|
||||
GraphicRoleFillColorTextOnAccentPrimary,
|
||||
GraphicRoleFillColorTextOnAccentSecondary,
|
||||
};
|
||||
|
||||
enum FontRole
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<RCC>
|
||||
<qresource prefix="/m3">
|
||||
<file>icons/qvg/check_small.qvg</file>
|
||||
<qresource prefix="/windows">
|
||||
<file>icons/qvg/checkmark.qvg</file>
|
||||
<file>icons/qvg/combo-box-arrow-closed.qvg</file>
|
||||
<file>icons/qvg/combo-box-arrow-open.qvg</file>
|
||||
<file>icons/qvg/segmented-button-check.qvg</file>
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
<svg width="12" height="10" viewBox="0 0 12 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4 9.4L0 5.4L1.4 4L4 6.6L10.6 0L12 1.4L4 9.4Z" fill="black"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 175 B |
|
@ -0,0 +1,4 @@
|
|||
<svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0.00195312 3.49805C0.00195312 3.36133 0.0507812 3.24414 0.148438 3.14648C0.246094 3.04883 0.363281 3 0.5 3C0.636719 3 0.753906 3.04883 0.851562 3.14648L3.5 5.79492L9.14844 0.146484C9.24609 0.0488281 9.36328 0 9.5 0C9.57031 0 9.63477 0.0136719 9.69336 0.0410156C9.75586 0.0644531 9.80859 0.0996094 9.85156 0.146484C9.89844 0.189453 9.93555 0.242187 9.96289 0.304688C9.99023 0.363281 10.0039 0.427734 10.0039 0.498047C10.0039 0.634766 9.95312 0.753906 9.85156 0.855469L3.85156 6.85547C3.75391 6.95312 3.63672 7.00195 3.5 7.00195C3.36328 7.00195 3.24609 6.95312 3.14844 6.85547L0.148438 3.85547C0.0507812 3.75781 0.00195312 3.63867 0.00195312 3.49805Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 777 B |
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue