segmented bar: Add own checkmark

The checkmark is slightly different from the one used in the
check box.
This commit is contained in:
Peter Hartmann 2023-01-27 16:36:42 +01:00 committed by uwerat
parent d75c07cbcc
commit c58593669d
7 changed files with 20 additions and 2 deletions

View File

@ -1090,6 +1090,11 @@ QskGraphic QskMaterial3Skin::symbol( int symbolType ) const
{ {
return {}; return {};
} }
case QskStandardSymbol::SegmentedBarCheckMark:
{
const auto* provider = graphicProvider( {} );
return *( provider->requestGraphic( "segmented-button-check" ) );
}
default: default:
return Inherited::symbol( symbolType ); return Inherited::symbol( symbolType );
} }

View File

@ -1,5 +1,6 @@
<RCC> <RCC>
<qresource> <qresource>
<file>icons/qvg/check_small.qvg</file> <file>icons/qvg/check_small.qvg</file>
<file>icons/qvg/segmented-button-check.qvg</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

View File

@ -0,0 +1,4 @@
<svg width="14" height="11" viewBox="0 0 14 11" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4.24914 8.12738L1.12164 4.99988L0.0566406 6.05738L4.24914 10.2499L13.2491 1.24988L12.1916 0.192383L4.24914 8.12738Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 246 B

View File

@ -9,6 +9,7 @@
#include "QskGraphic.h" #include "QskGraphic.h"
#include "QskColorFilter.h" #include "QskColorFilter.h"
#include "QskFunctions.h" #include "QskFunctions.h"
#include "QskSkin.h"
#include "QskStandardSymbol.h" #include "QskStandardSymbol.h"
#include "QskSubcontrolLayoutEngine.h" #include "QskSubcontrolLayoutEngine.h"
@ -37,7 +38,7 @@ namespace
// implementing this control we should put this code into a // implementing this control we should put this code into a
// subclass. // subclass.
const auto graphic = ( bar->selectedIndex() == index ) const auto graphic = ( bar->selectedIndex() == index )
? QskStandardSymbol::graphic( QskStandardSymbol::CheckMark ) ? bar->effectiveSkin()->symbol( QskStandardSymbol::SegmentedBarCheckMark )
: bar->graphicAt( index ); : bar->graphicAt( index );
return graphic; return graphic;
@ -215,7 +216,7 @@ QSizeF QskSegmentedBarSkinlet::segmentSizeHint( const QskSegmentedBar* bar, Qt::
{ {
LayoutEngine layoutEngine( bar, i ); LayoutEngine layoutEngine( bar, i );
const auto graphic = QskStandardSymbol::graphic( QskStandardSymbol::CheckMark ); const auto graphic = bar->effectiveSkin()->symbol( QskStandardSymbol::SegmentedBarCheckMark );
// We want to know how big the element can grow when it is selected, // We want to know how big the element can grow when it is selected,
// i.e. when it has the checkmark symbol: // i.e. when it has the checkmark symbol:

View File

@ -260,6 +260,11 @@ QskGraphic QskStandardSymbol::graphic( Type symbolType )
qskCrossMarkGraphic( &painter ); qskCrossMarkGraphic( &painter );
break; break;
} }
case QskStandardSymbol::SegmentedBarCheckMark:
{
qskCheckMarkGraphic( &painter );
break;
}
case QskStandardSymbol::NoSymbol: case QskStandardSymbol::NoSymbol:
case QskStandardSymbol::SymbolTypeCount: case QskStandardSymbol::SymbolTypeCount:
{ {

View File

@ -30,6 +30,8 @@ namespace QskStandardSymbol
CheckMark, CheckMark,
CrossMark, CrossMark,
SegmentedBarCheckMark,
SymbolTypeCount SymbolTypeCount
}; };