using "icon" instead of "graphic".

"icon" was not used to avoid confusing with QIcon,
but it is probably more confusing not to use the name that
is used by almost all toolkits.
This commit is contained in:
Uwe Rathmann 2023-03-08 14:11:27 +01:00
parent 3b88f7cd61
commit 484780a40e
31 changed files with 218 additions and 218 deletions

View File

@ -87,7 +87,7 @@ Qsk.Window
TestButton
{
text: "Check Me"
graphicSource: "image://shapes/Ring/Khaki"
iconSource: "image://shapes/Ring/Khaki"
checkable: true
}
@ -117,11 +117,11 @@ Qsk.Window
TestButton
{
graphicSource: "image://shapes/Diamond/SandyBrown"
iconSource: "image://shapes/Diamond/SandyBrown"
graphicStrutSize
iconStrutSize
{
// no strutSize, so that the graphic is adjustd
// no strutSize, so that the icon is adjustd
width: -1
height : -1
}

View File

@ -46,18 +46,18 @@ namespace
void populate()
{
auto* filledButton1 = new QskPushButton( this );
filledButton1->setGraphicSource( "airport_shuttle" );
filledButton1->setIconSource( "airport_shuttle" );
filledButton1->setText( "normal" );
auto* filledButton2 = new QskPushButton( this );
filledButton2->setText( "normal" );
auto* filledButton3 = new QskPushButton( this );
filledButton3->setGraphicSource( "airport_shuttle" );
filledButton3->setIconSource( "airport_shuttle" );
auto* checkableButton1 = new QskPushButton( this );
checkableButton1->setGraphicSource( "airport_shuttle" );
checkableButton1->setIconSource( "airport_shuttle" );
checkableButton1->setText( "checkable" );
checkableButton1->setCheckable( true );
@ -66,13 +66,13 @@ namespace
checkableButton2->setCheckable( true );
auto* checkableButton3 = new QskPushButton( this );
checkableButton3->setGraphicSource( "airport_shuttle" );
checkableButton3->setIconSource( "airport_shuttle" );
checkableButton3->setCheckable( true );
auto* outlinedButton1 = new QskPushButton( this );
outlinedButton1->setEmphasis( QskPushButton::LowEmphasis );
outlinedButton1->setGraphicSource( "flight" );
outlinedButton1->setIconSource( "flight" );
outlinedButton1->setText( "low emphasis" );
auto* outlinedButton2 = new QskPushButton( this );
@ -81,12 +81,12 @@ namespace
auto* outlinedButton3 = new QskPushButton( this );
outlinedButton3->setEmphasis( QskPushButton::LowEmphasis );
outlinedButton3->setGraphicSource( "flight" );
outlinedButton3->setIconSource( "flight" );
auto* textButton1 = new QskPushButton( this );
textButton1->setEmphasis( QskPushButton::VeryLowEmphasis );
textButton1->setGraphicSource( "local_pizza" );
textButton1->setIconSource( "local_pizza" );
textButton1->setText( "very low emphasis" );
auto* textButton2 = new QskPushButton( this );
@ -95,12 +95,12 @@ namespace
auto* textButton3 = new QskPushButton( this );
textButton3->setEmphasis( QskPushButton::VeryLowEmphasis );
textButton3->setGraphicSource( "local_pizza" );
textButton3->setIconSource( "local_pizza" );
auto* elevatedButton1 = new QskPushButton( this );
elevatedButton1->setEmphasis( QskPushButton::HighEmphasis );
elevatedButton1->setGraphicSource( "plus" );
elevatedButton1->setIconSource( "plus" );
elevatedButton1->setText( "high emphasis" );
auto* elevatedButton2 = new QskPushButton( this );
@ -109,12 +109,12 @@ namespace
auto* elevatedButton3 = new QskPushButton( this );
elevatedButton3->setEmphasis( QskPushButton::HighEmphasis );
elevatedButton3->setGraphicSource( "plus" );
elevatedButton3->setIconSource( "plus" );
auto* tonalButton1 = new QskPushButton( this );
tonalButton1->setEmphasis( QskPushButton::VeryHighEmphasis );
tonalButton1->setGraphicSource( "sports_soccer" );
tonalButton1->setIconSource( "sports_soccer" );
tonalButton1->setText( "very high emphasis" );
auto* tonalButton2 = new QskPushButton( this );
@ -123,7 +123,7 @@ namespace
auto* tonalButton3 = new QskPushButton( this );
tonalButton3->setEmphasis( QskPushButton::VeryHighEmphasis );
tonalButton3->setGraphicSource( "sports_soccer" );
tonalButton3->setIconSource( "sports_soccer" );
}
};

View File

@ -57,8 +57,8 @@ BoxWithButtons::BoxWithButtons(
layout->setSpacing( 20 );
auto iconLabel = new RoundedIcon( isBright, layout );
iconLabel->setGraphicSource( title );
iconLabel->setGraphicStrutSize( { 35.17, 35.17 } );
iconLabel->setIconSource( title );
iconLabel->setIconStrutSize( { 35.17, 35.17 } );
iconLabel->setFixedSize( 68, 68 );
auto titleAndValue = new QskLinearBox( Qt::Vertical, layout );

View File

@ -7,11 +7,11 @@
#include <QTimer>
QSK_SUBCONTROL( MenuBarTopLabel, Graphic )
QSK_SUBCONTROL( MenuBarTopLabel, Icon )
QSK_SUBCONTROL( MenuButton, Panel )
QSK_SUBCONTROL( MenuButton, Text )
QSK_SUBCONTROL( MenuButton, Graphic )
QSK_SUBCONTROL( MenuButton, Icon )
QSK_SUBCONTROL( MenuBar, Panel )
@ -23,9 +23,9 @@ MenuButton::MenuButton( const QString& name, QQuickItem* parent )
setSubcontrolProxy( QskPushButton::Panel, MenuButton::Panel );
setSubcontrolProxy( QskPushButton::Text, MenuButton::Text );
setSubcontrolProxy( QskPushButton::Graphic, MenuButton::Graphic );
setSubcontrolProxy( QskPushButton::Icon, MenuButton::Icon );
setGraphicSource( name );
setIconSource( name );
}
MenuBar::MenuBar( QQuickItem* parent )

View File

@ -17,7 +17,7 @@ class MenuBarTopLabel final : public QskGraphicLabel
Q_OBJECT
public:
QSK_SUBCONTROLS( Graphic )
QSK_SUBCONTROLS( Icon )
MenuBarTopLabel( const QString& icon, QQuickItem* parent = nullptr )
: QskGraphicLabel( icon, parent )
@ -31,7 +31,7 @@ class MenuButton final : public QskPushButton
Q_OBJECT
public:
QSK_SUBCONTROLS( Panel, Text, Graphic )
QSK_SUBCONTROLS( Panel, Text, Icon )
MenuButton( const QString& name, QQuickItem* parent );
};

View File

@ -26,8 +26,8 @@ namespace
auto icon = new RoundedIcon( isBright, this );
icon->setPale( true );
icon->setGraphicSource( name );
icon->setGraphicStrutSize( { 36, 36 } );
icon->setIconSource( name );
icon->setIconStrutSize( { 36, 36 } );
icon->setFixedSize( 68, 68 );
icon->setCheckable( true );

View File

@ -19,14 +19,14 @@ RoundButton::RoundButton( Qt::Edge edge, QQuickItem* parent )
if( edge == Qt::TopEdge )
{
setSkinStateFlag( Top );
setGraphicSource( "up" );
setIconSource( "up" );
}
else
{
setGraphicSource( "down" );
setIconSource( "down" );
}
setGraphicStrutSize( graphic().defaultSize() * 1.2 );
setIconStrutSize( icon().defaultSize() * 1.2 );
}
#include "moc_RoundButton.cpp"

View File

@ -19,7 +19,7 @@ RoundedIcon::RoundedIcon( bool isBright, QQuickItem* parent )
setPale( false );
setSubcontrolProxy( QskPushButton::Graphic, Graphic );
setSubcontrolProxy( QskPushButton::Icon, Icon );
}
void RoundedIcon::setPale( bool on )

View File

@ -107,9 +107,9 @@ void Skin::initHints( const Palette& palette )
ed.setFontRole( MenuButton::Text, QskSkin::SmallFont );
ed.setAlignment( MenuButton::Text, Qt::AlignLeft | Qt::AlignVCenter );
ed.setPadding( MenuButton::Graphic, { 30, 0, 0, 0 } );
ed.setStrutSize( MenuButton::Graphic, { 14, -1 } );
ed.setAlignment( MenuButton::Graphic, Qt::AlignCenter );
ed.setPadding( MenuButton::Icon, { 30, 0, 0, 0 } );
ed.setStrutSize( MenuButton::Icon, { 14, -1 } );
ed.setAlignment( MenuButton::Icon, Qt::AlignCenter );
// top bar:

View File

@ -106,12 +106,12 @@ class MySkinEditor : public QskSkinHintTableEditor
setAnimation( subControl | A::Color, animator() );
}
for( auto subControl : { Q::UncheckedGraphic, Q::CheckedGraphic } )
for( auto subControl : { Q::UncheckedIcon, Q::CheckedIcon } )
{
int role1 = MySkin::GraphicRoleInverted;
int role2 = MySkin::GraphicRoleNormal;
if( subControl == Q::CheckedGraphic )
if( subControl == Q::CheckedIcon )
std::swap( role1, role2 );
setGraphicRole( subControl, role1 );

View File

@ -16,8 +16,8 @@ QSK_SUBCONTROL( MyToggleButton, CheckedPanel )
QSK_SUBCONTROL( MyToggleButton, CheckedText )
QSK_SUBCONTROL( MyToggleButton, UncheckedPanel )
QSK_SUBCONTROL( MyToggleButton, UncheckedText )
QSK_SUBCONTROL( MyToggleButton, CheckedGraphic )
QSK_SUBCONTROL( MyToggleButton, UncheckedGraphic )
QSK_SUBCONTROL( MyToggleButton, CheckedIcon )
QSK_SUBCONTROL( MyToggleButton, UncheckedIcon )
class MyToggleButton::PrivateData
{

View File

@ -16,8 +16,8 @@ class MyToggleButton : public QskAbstractButton
using Inherited = QskAbstractButton;
public:
QSK_SUBCONTROLS( Panel, Cursor, CheckedPanel, CheckedText, CheckedGraphic,
UncheckedPanel, UncheckedText, UncheckedGraphic )
QSK_SUBCONTROLS( Panel, Cursor, CheckedPanel, CheckedText, CheckedIcon,
UncheckedPanel, UncheckedText, UncheckedIcon )
MyToggleButton( QQuickItem* parent = nullptr );
~MyToggleButton() override;

View File

@ -55,11 +55,11 @@ QRectF MyToggleButtonSkinlet::subControlRect( const QskSkinnable* skinnable,
const auto r = button->subControlContentsRect( contentsRect, Q::Panel );
return sectionRect( r, button->isInverted() ? 0 : 1 );
}
else if( subControl == Q::CheckedText || subControl == Q::CheckedGraphic )
else if( subControl == Q::CheckedText || subControl == Q::CheckedIcon )
{
return button->subControlContentsRect( contentsRect, Q::CheckedPanel );
}
else if( subControl == Q::UncheckedText || subControl == Q::UncheckedGraphic )
else if( subControl == Q::UncheckedText || subControl == Q::UncheckedIcon )
{
return button->subControlContentsRect( contentsRect, Q::UncheckedPanel );
}
@ -109,13 +109,13 @@ QSGNode* MyToggleButtonSkinlet::updateSubNode(
case CheckedGraphicRole:
{
return updateGraphicNode(
button, node, button->graphic( true ), Q::CheckedGraphic );
button, node, button->graphic( true ), Q::CheckedIcon );
}
case UncheckedGraphicRole:
{
return updateGraphicNode(
button, node, button->graphic( false ), Q::UncheckedGraphic );
button, node, button->graphic( false ), Q::UncheckedIcon );
}
case CursorRole:

View File

@ -72,11 +72,11 @@ class Thumbnail : public QskPushButton
{
const QSizeF size( thumbnailSize, thumbnailSize );
setGraphic( thumbnailGraphic( color, shape, size ) );
setIcon( thumbnailGraphic( color, shape, size ) );
setFixedSize( size );
setBoxShapeHint( QskPushButton::Panel, QskBoxShapeMetrics( 20, Qt::RelativeSize ) );
setStrutSizeHint( QskPushButton::Graphic, -1, -1 );
setStrutSizeHint( QskPushButton::Icon, -1, -1 );
setSection( QskAspect::Header ); // to make them flat
}

View File

@ -294,29 +294,29 @@ void Editor::setupComboBox()
m_pal.surfaceVariant, m_pal.pressedOpacity );
setGradient( Q::Panel | Q::PopupOpen, activeColor );
setStrutSize( Q::Graphic, 24_dp, 24_dp );
setGraphicRole( Q::Graphic, QskMaterial3Skin::GraphicRoleOnSurface );
setStrutSize( Q::Icon, 24_dp, 24_dp );
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleOnSurface );
setColor( Q::Text, m_pal.onSurface );
setFontRole( Q::Text, QskMaterial3Skin::M3BodyMedium );
setStrutSize( Q::PopupIndicator, 12_dp, 12_dp );
setGraphicRole( Q::PopupIndicator, QskMaterial3Skin::GraphicRoleOnSurface );
setAlignment( Q::PopupIndicator, Qt::AlignRight | Qt::AlignVCenter );
setStrutSize( Q::StatusIndicator, 12_dp, 12_dp );
setGraphicRole( Q::StatusIndicator, QskMaterial3Skin::GraphicRoleOnSurface );
setAlignment( Q::StatusIndicator, Qt::AlignRight | Qt::AlignVCenter );
const auto disabledPanelColor = QskRgb::toTransparentF( m_pal.onSurface, 0.04 );
setGradient( Q::Panel | Q::Disabled, disabledPanelColor );
setBoxBorderColors( Q::Panel | Q::Disabled, m_pal.onSurface38 );
setGraphicRole( Q::Graphic, QskMaterial3Skin::GraphicRoleOnSurface38 );
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleOnSurface38 );
setColor( Q::Text | Q::Disabled, m_pal.onSurface38 );
setGraphicRole( Q::PopupIndicator, QskMaterial3Skin::GraphicRoleOnSurface38 );
setGraphicRole( Q::StatusIndicator, QskMaterial3Skin::GraphicRoleOnSurface38 );
setSymbol( Q::PopupIndicator, symbol( "combo-box-arrow-closed" ) );
setSymbol( Q::PopupIndicator | Q::PopupOpen, symbol( "combo-box-arrow-open" ) );
setSymbol( Q::StatusIndicator, symbol( "combo-box-arrow-closed" ) );
setSymbol( Q::StatusIndicator | Q::PopupOpen, symbol( "combo-box-arrow-open" ) );
}
void Editor::setupBox()
@ -369,9 +369,9 @@ void Editor::setupMenu()
setGradient( Q::Cursor, m_pal.primary12 );
setPadding( Q::Graphic, 7_dp );
setStrutSize( Q::Graphic, 24_dp, 24_dp );
setGraphicRole( Q::Graphic, QskMaterial3Skin::GraphicRoleOnSurface );
setPadding( Q::Icon, 7_dp );
setStrutSize( Q::Icon, 24_dp, 24_dp );
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleOnSurface );
setColor( Q::Text, m_pal.onSurface );
setFontRole( Q::Text, QskMaterial3Skin::M3BodyMedium );
@ -586,15 +586,15 @@ void Editor::setupSegmentedBar()
}
{
// Graphic
// Icon
setSymbol( Q::Graphic, symbol( "segmented-button-check" ) );
setStrutSize( Q::Graphic, 18_dp, 18_dp );
setSymbol( Q::Icon, symbol( "segmented-button-check" ) );
setStrutSize( Q::Icon, 18_dp, 18_dp );
setGraphicRole( Q::Graphic, QskMaterial3Skin::GraphicRoleOnSurface );
setGraphicRole( Q::Graphic | Q::Selected,
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleOnSurface );
setGraphicRole( Q::Icon | Q::Selected,
QskMaterial3Skin::GraphicRoleOnSecondaryContainer );
setGraphicRole( Q::Graphic | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38 );
setGraphicRole( Q::Icon | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38 );
}
}
@ -647,9 +647,9 @@ void Editor::setupPushButton()
setPadding( Q::Panel, { 24_dp, 0, 24_dp, 0 } );
setBoxShape( Q::Panel, 100, Qt::RelativeSize );
setStrutSize( Q::Graphic, 18_dp, 18_dp );
setPadding( Q::Graphic, { 0, 0, 8_dp, 0 } );
setGraphicRole( Q::Graphic, QskMaterial3Skin::GraphicRoleOnPrimary );
setStrutSize( Q::Icon, 18_dp, 18_dp );
setPadding( Q::Icon, { 0, 0, 8_dp, 0 } );
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleOnPrimary );
setFontRole( Q::Text, QskMaterial3Skin::M3LabelLarge );
setPadding( Q::Text, 0 );
@ -664,14 +664,14 @@ void Editor::setupPushButton()
setGradient( Q::Panel | M3::Elevated, m_pal.surface1 );
setShadowMetrics( Q::Panel | M3::Elevated, m_pal.elevation1 );
setColor( Q::Text | M3::Elevated, m_pal.primary );
setGraphicRole( Q::Graphic | M3::Elevated, QskMaterial3Skin::GraphicRolePrimary );
setGraphicRole( Q::Icon | M3::Elevated, QskMaterial3Skin::GraphicRolePrimary );
setGradient( Q::Splash | M3::Elevated,
stateLayerColor( m_pal.primary, m_pal.pressedOpacity ) );
setGradient( Q::Panel | M3::Elevated | Q::Disabled, m_pal.onSurface12 );
setShadowMetrics( Q::Panel | M3::Elevated | Q::Disabled, m_pal.elevation0 );
setColor( Q::Text | M3::Elevated | Q::Disabled, m_pal.onSurface38 );
setGraphicRole( Q::Graphic | M3::Elevated | Q::Disabled,
setGraphicRole( Q::Icon | M3::Elevated | Q::Disabled,
QskMaterial3Skin::GraphicRoleOnSurface38 );
const auto elevatedHoverColor =
@ -707,7 +707,7 @@ void Editor::setupPushButton()
setColor( Q::Text, m_pal.onPrimary );
setColor( Q::Text | Q::Disabled, m_pal.onSurface38 );
setGraphicRole( Q::Graphic | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38 );
setGraphicRole( Q::Icon | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38 );
setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap );
@ -717,13 +717,13 @@ void Editor::setupPushButton()
setGradient( Q::Panel | M3::Tonal, m_pal.secondaryContainer );
setShadowMetrics( Q::Panel | M3::Tonal, m_pal.elevation0 );
setColor( Q::Text | M3::Tonal, m_pal.onSecondaryContainer );
setGraphicRole( Q::Graphic | M3::Tonal, QskMaterial3Skin::GraphicRoleOnSecondaryContainer );
setGraphicRole( Q::Icon | M3::Tonal, QskMaterial3Skin::GraphicRoleOnSecondaryContainer );
setGradient( Q::Splash | M3::Tonal,
stateLayerColor( m_pal.onSecondaryContainer, m_pal.pressedOpacity ) );
setGradient( Q::Panel | M3::Tonal | Q::Disabled, m_pal.onSurface12 );
setColor( Q::Text | M3::Tonal | Q::Disabled, m_pal.onSurface38 );
setGraphicRole( Q::Graphic | M3::Tonal | Q::Disabled,
setGraphicRole( Q::Icon | M3::Tonal | Q::Disabled,
QskMaterial3Skin::GraphicRoleOnSurface38 );
const auto tonalHoverColor = flattenedColor( m_pal.onSecondaryContainer,
@ -748,13 +748,13 @@ void Editor::setupPushButton()
setShadowMetrics( Q::Panel | M3::Outlined, m_pal.elevation0 );
setColor( Q::Text | M3::Outlined, m_pal.primary );
setGraphicRole( Q::Graphic | M3::Outlined, QskMaterial3Skin::GraphicRolePrimary );
setGraphicRole( Q::Icon | M3::Outlined, QskMaterial3Skin::GraphicRolePrimary );
setGradient( Q::Splash | M3::Outlined,
stateLayerColor( m_pal.outline, m_pal.pressedOpacity ) );
setBoxBorderColors( Q::Panel | M3::Outlined | Q::Disabled, m_pal.onSurface12 );
setColor( Q::Text | M3::Outlined | Q::Disabled, m_pal.onSurface38 );
setGraphicRole( Q::Graphic | M3::Outlined | Q::Disabled,
setGraphicRole( Q::Icon | M3::Outlined | Q::Disabled,
QskMaterial3Skin::GraphicRoleOnSurface38 );
setBoxBorderColors( Q::Panel | M3::Outlined | Q::Hovered, m_pal.outline );
@ -778,12 +778,12 @@ void Editor::setupPushButton()
setShadowMetrics( Q::Panel | M3::Text, m_pal.elevation0 );
setColor( Q::Text | M3::Text, m_pal.primary );
setGraphicRole( Q::Graphic | M3::Text, QskMaterial3Skin::GraphicRolePrimary );
setGraphicRole( Q::Icon | M3::Text, QskMaterial3Skin::GraphicRolePrimary );
setGradient( Q::Splash | M3::Text,
stateLayerColor( m_pal.primary, m_pal.pressedOpacity ) );
setColor( Q::Text | M3::Text | Q::Disabled, m_pal.onSurface38 );
setGraphicRole( Q::Graphic | M3::Text | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38 );
setGraphicRole( Q::Icon | M3::Text | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38 );
setGradient( Q::Panel | M3::Text | Q::Hovered, m_pal.primary8 );

View File

@ -383,17 +383,17 @@ void Editor::setupComboBox()
setBoxBorderColors( Q::Panel, borderColors );
setGradient( Q::Panel, c );
setStrutSize( Q::Graphic, 24_dp, 24_dp );
setGraphicRole( Q::Graphic | Q::Disabled, DisabledSymbol );
setStrutSize( Q::Icon, 24_dp, 24_dp );
setGraphicRole( Q::Icon | Q::Disabled, DisabledSymbol );
setStrutSize( Q::PopupIndicator, 15_dp, 15_dp );
setGraphicRole( Q::PopupIndicator | Q::Disabled, DisabledSymbol );
setStrutSize( Q::StatusIndicator, 15_dp, 15_dp );
setGraphicRole( Q::StatusIndicator | Q::Disabled, DisabledSymbol );
setAlignment( Q::PopupIndicator, Qt::AlignRight | Qt::AlignVCenter );
setAlignment( Q::StatusIndicator, Qt::AlignRight | Qt::AlignVCenter );
setSymbol( Q::PopupIndicator,
setSymbol( Q::StatusIndicator,
QskStandardSymbol::graphic( QskStandardSymbol::TriangleDown ) );
setSymbol( Q::PopupIndicator | Q::PopupOpen,
setSymbol( Q::StatusIndicator | Q::PopupOpen,
QskStandardSymbol::graphic( QskStandardSymbol::TriangleUp ) );
}
@ -435,9 +435,9 @@ void Editor::setupMenu()
setColor( Q::Text, m_pal.contrastedText );
setColor( Q::Text | Q::Selected, m_pal.highlightedText );
setStrutSize( Q::Graphic, 16, 16 );
setGraphicRole( Q::Graphic | Q::Disabled, DisabledSymbol );
setGraphicRole( Q::Graphic | Q::Selected, CursorSymbol );
setStrutSize( Q::Icon, 16, 16 );
setGraphicRole( Q::Icon | Q::Disabled, DisabledSymbol );
setGraphicRole( Q::Icon | Q::Selected, CursorSymbol );
setPosition( Q::Panel, 0 );
setPosition( Q::Panel | QskPopup::Closed, 1 );
@ -613,11 +613,11 @@ void Editor::setupSegmentedBar()
}
{
// Graphic
// Icon
setGraphicRole( Q::Graphic | Q::Disabled, DisabledSymbol );
setGraphicRole( Q::Graphic | Q::Selected, CursorSymbol );
setStrutSize( Q::Graphic, -1, 30_dp );
setGraphicRole( Q::Icon | Q::Disabled, DisabledSymbol );
setGraphicRole( Q::Icon | Q::Selected, CursorSymbol );
setStrutSize( Q::Icon, -1, 30_dp );
}
}
@ -682,8 +682,8 @@ void Editor::setupPushButton()
setColor( Q::Text, m_pal.themeForeground );
setColor( Q::Text | Q::Disabled, m_pal.darker200 );
// Graphic
setAlignment( Q::Graphic, Qt::AlignCenter );
// Icon
setAlignment( Q::Icon, Qt::AlignCenter );
}
void Editor::setupRadioBox()

View File

@ -15,9 +15,9 @@
#include <qquickwindow.h>
QSK_SUBCONTROL( QskComboBox, Panel )
QSK_SUBCONTROL( QskComboBox, Graphic )
QSK_SUBCONTROL( QskComboBox, Icon )
QSK_SUBCONTROL( QskComboBox, Text )
QSK_SUBCONTROL( QskComboBox, PopupIndicator )
QSK_SUBCONTROL( QskComboBox, StatusIndicator )
QSK_SYSTEM_STATE( QskComboBox, PopupOpen, QskAspect::FirstSystemState << 1 )
@ -138,7 +138,7 @@ bool QskComboBox::isPopupOpen() const
return hasSkinState( PopupOpen );
}
QskGraphic QskComboBox::graphic() const
QskGraphic QskComboBox::icon() const
{
if( m_data->currentIndex >= 0 )
{

View File

@ -31,7 +31,7 @@ class QSK_EXPORT QskComboBox : public QskControl
using Inherited = QskControl;
public:
QSK_SUBCONTROLS( Panel, Graphic, Text, PopupIndicator )
QSK_SUBCONTROLS( Panel, Icon, Text, StatusIndicator )
QSK_STATES( PopupOpen )
QskComboBox( QQuickItem* parent = nullptr );
@ -41,14 +41,14 @@ class QSK_EXPORT QskComboBox : public QskControl
void setPopupOpen( bool );
bool isPopupOpen() const;
QskGraphic graphic() const;
QskGraphic icon() const;
void setTextOptions( const QskTextOptions& );
QskTextOptions textOptions() const;
void addOption( const QString& text );
void addOption( const QUrl& graphicSource, const QString& text );
void addOption( const QString& graphicSource, const QString& text );
void addOption( const QUrl& iconSource, const QString& text );
void addOption( const QString& iconSource, const QString& text );
void addOption( const QskGraphic&, const QString& text );
void clear();

View File

@ -54,7 +54,7 @@ namespace
setGraphicTextElements( box,
QskComboBox::Text, qskValueAt< QString >( box ),
QskComboBox::Graphic, qskValueAt< QskGraphic >( box ).defaultSize() );
QskComboBox::Icon, qskValueAt< QskGraphic >( box ).defaultSize() );
const auto alignment = box->alignmentHint(
QskComboBox::Panel, Qt::AlignLeft );
@ -66,7 +66,7 @@ namespace
QskComboBoxSkinlet::QskComboBoxSkinlet( QskSkin* skin )
: Inherited( skin )
{
setNodeRoles( { PanelRole, GraphicRole, TextRole, PopupIndicatorRole } );
setNodeRoles( { PanelRole, IconRole, TextRole, StatusIndicatorRole } );
}
QskComboBoxSkinlet::~QskComboBoxSkinlet() = default;
@ -81,7 +81,7 @@ QRectF QskComboBoxSkinlet::subControlRect( const QskSkinnable* skinnable,
if ( subControl == Q::Panel )
return contentsRect;
if ( subControl == Q::Text || subControl == Q::Graphic )
if ( subControl == Q::Text || subControl == Q::Icon )
{
const auto r = box->subControlContentsRect( contentsRect, Q::Panel );
@ -91,10 +91,10 @@ QRectF QskComboBoxSkinlet::subControlRect( const QskSkinnable* skinnable,
return layoutEngine.subControlRect( subControl );
}
if( subControl == Q::PopupIndicator )
if( subControl == Q::StatusIndicator )
{
auto rect = box->innerBox( Q::Panel, contentsRect );
const auto size = box->strutSizeHint( Q::PopupIndicator );
const auto size = box->strutSizeHint( Q::StatusIndicator );
rect.setLeft( rect.right() - size.width() );
return rect;
}
@ -114,14 +114,14 @@ QSGNode* QskComboBoxSkinlet::updateSubNode(
case PanelRole:
return updateBoxNode( box, node, Q::Panel );
case GraphicRole:
return updateGraphicNode( box, node, box->graphic(), Q::Graphic );
case IconRole:
return updateGraphicNode( box, node, box->icon(), Q::Icon );
case TextRole:
return updateTextNode( box, node );
case PopupIndicatorRole:
return updateSymbolNode( box, node, Q::PopupIndicator );
case StatusIndicatorRole:
return updateSymbolNode( box, node, Q::StatusIndicator );
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
@ -158,7 +158,7 @@ QSizeF QskComboBoxSkinlet::sizeHint( const QskSkinnable* skinnable,
auto size = layoutEngine.sizeHint( which, QSizeF() );
const auto spacingHint = box->spacingHint( Q::Panel );
const auto menuGraphicHint = box->strutSizeHint( Q::PopupIndicator );
const auto menuGraphicHint = box->strutSizeHint( Q::StatusIndicator );
size.rwidth() += spacingHint + menuGraphicHint.width();

View File

@ -20,9 +20,9 @@ class QSK_EXPORT QskComboBoxSkinlet : public QskSkinlet
enum NodeRole
{
PanelRole,
GraphicRole,
IconRole,
TextRole,
PopupIndicatorRole,
StatusIndicatorRole,
RoleCount
};

View File

@ -22,7 +22,7 @@ QSK_SUBCONTROL( QskMenu, Panel )
QSK_SUBCONTROL( QskMenu, Segment )
QSK_SUBCONTROL( QskMenu, Cursor )
QSK_SUBCONTROL( QskMenu, Text )
QSK_SUBCONTROL( QskMenu, Graphic )
QSK_SUBCONTROL( QskMenu, Icon )
QSK_SUBCONTROL( QskMenu, Separator )
QSK_SYSTEM_STATE( QskMenu, Selected, QskAspect::FirstSystemState << 2 )

View File

@ -34,7 +34,7 @@ class QSK_EXPORT QskMenu : public QskPopup
using Inherited = QskPopup;
public:
QSK_SUBCONTROLS( Overlay, Panel, Segment, Cursor, Text, Graphic, Separator )
QSK_SUBCONTROLS( Overlay, Panel, Segment, Cursor, Text, Icon, Separator )
QSK_STATES( Selected )
QskMenu( QQuickItem* parentItem = nullptr );
@ -51,8 +51,8 @@ class QSK_EXPORT QskMenu : public QskPopup
QskTextOptions textOptions() const;
// insert, remove, functors, actions
void addOption( const QUrl& graphicSource, const QString& text );
void addOption( const QString& graphicSource, const QString& text );
void addOption( const QUrl& iconSource, const QString& text );
void addOption( const QString& iconSource, const QString& text );
void addOption( const QskGraphic&, const QString& text );
void addOption( const QString& text );

View File

@ -133,7 +133,7 @@ class QskMenuSkinlet::PrivateData
{
const auto skinlet = menu->effectiveSkinlet();
const auto hint = menu->strutSizeHint( QskMenu::Graphic );
const auto hint = menu->strutSizeHint( QskMenu::Icon );
const qreal textHeight = menu->effectiveFontHeight( QskMenu::Text );
const auto h = qMax( hint.height(), textHeight );
@ -141,7 +141,7 @@ class QskMenuSkinlet::PrivateData
qreal maxW = 0.0;
for ( int i = 0; i < menu->count(); i++ )
{
const auto sample = skinlet->sampleAt( menu, QskMenu::Graphic, i );
const auto sample = skinlet->sampleAt( menu, QskMenu::Icon, i );
if ( sample.canConvert< QskGraphic >() )
{
const auto graphic = sample.value< QskGraphic >();
@ -202,7 +202,7 @@ class QskMenuSkinlet::PrivateData
{
using Q = QskMenu;
const auto graphicHeight = menu->strutSizeHint( Q::Graphic ).height();
const auto graphicHeight = menu->strutSizeHint( Q::Icon ).height();
const auto textHeight = menu->effectiveFontHeight( Q::Text );
const auto padding = menu->paddingHint( Q::Segment );
@ -313,16 +313,16 @@ QRectF QskMenuSkinlet::sampleRect(
return QRectF( r.x(), r.y() + index * h, r.width(), h );
}
if ( subControl == QskMenu::Graphic || subControl == QskMenu::Text )
if ( subControl == QskMenu::Icon || subControl == QskMenu::Text )
{
const auto r = sampleRect( menu, contentsRect, Q::Segment, index );
const auto graphicWidth = m_data->graphicWidth( menu );
if ( subControl == QskMenu::Graphic )
if ( subControl == QskMenu::Icon )
{
auto graphicRect = r;
graphicRect.setWidth( graphicWidth );
const auto padding = menu->paddingHint( QskMenu::Graphic );
const auto padding = menu->paddingHint( QskMenu::Icon );
graphicRect = graphicRect.marginsRemoved( padding );
return graphicRect;
@ -378,7 +378,7 @@ int QskMenuSkinlet::sampleCount(
{
using Q = QskMenu;
if ( subControl == Q::Segment || subControl == Q::Graphic || subControl == Q::Text )
if ( subControl == Q::Segment || subControl == Q::Icon || subControl == Q::Text )
{
const auto menu = static_cast< const QskMenu* >( skinnable );
return menu->count();
@ -400,7 +400,7 @@ QskAspect::States QskMenuSkinlet::sampleStates(
auto states = Inherited::sampleStates( skinnable, subControl, index );
if ( subControl == Q::Segment || subControl == Q::Graphic || subControl == Q::Text )
if ( subControl == Q::Segment || subControl == Q::Icon || subControl == Q::Text )
{
const auto menu = static_cast< const QskMenu* >( skinnable );
if ( menu->currentIndex() == index )
@ -417,7 +417,7 @@ QVariant QskMenuSkinlet::sampleAt( const QskSkinnable* skinnable,
const auto menu = static_cast< const QskMenu* >( skinnable );
if ( subControl == Q::Graphic )
if ( subControl == Q::Icon )
return qskSampleAt< QskGraphic >( menu, index );
if ( subControl == Q::Text )
@ -436,8 +436,8 @@ QSGNode* QskMenuSkinlet::updateContentsNode(
QSGNode* QskMenuSkinlet::updateMenuNode(
const QskSkinnable* skinnable, QSGNode* contentsNode ) const
{
enum { Panel, Segment, Cursor, Graphic, Text, Separator };
static QVector< quint8 > roles = { Panel, Separator, Segment, Cursor, Graphic, Text };
enum { Panel, Segment, Cursor, Icon, Text, Separator };
static QVector< quint8 > roles = { Panel, Separator, Segment, Cursor, Icon, Text };
if ( contentsNode == nullptr )
contentsNode = new QSGNode();
@ -465,9 +465,9 @@ QSGNode* QskMenuSkinlet::updateMenuNode(
newNode = updateBoxNode( skinnable, oldNode, QskMenu::Cursor );
break;
}
case Graphic:
case Icon:
{
newNode = updateSeriesNode( skinnable, QskMenu::Graphic, oldNode );
newNode = updateSeriesNode( skinnable, QskMenu::Icon, oldNode );
break;
}
case Text:
@ -502,7 +502,7 @@ QSGNode* QskMenuSkinlet::updateSampleNode( const QskSkinnable* skinnable,
return updateBoxNode( menu, node, rect, subControl );
}
if ( subControl == Q::Graphic )
if ( subControl == Q::Icon )
{
const auto graphic = qskValueAt< QskGraphic >( menu, index );
if ( graphic.isNull() )

View File

@ -18,7 +18,7 @@
QSK_SUBCONTROL( QskPushButton, Panel )
QSK_SUBCONTROL( QskPushButton, Splash )
QSK_SUBCONTROL( QskPushButton, Text )
QSK_SUBCONTROL( QskPushButton, Graphic )
QSK_SUBCONTROL( QskPushButton, Icon )
class QskPushButton::PrivateData
{
@ -26,29 +26,29 @@ class QskPushButton::PrivateData
PrivateData( const QString& txt )
: text( txt )
, isCheckable( false )
, isGraphicSourceDirty( false )
, isIconSourceDirty( false )
, emphasis( NoEmphasis )
{
}
void ensureGraphic( const QskPushButton* button )
void ensureIcon( const QskPushButton* button )
{
if ( isGraphicSourceDirty )
if ( isIconSourceDirty )
{
if ( !graphicSource.isEmpty() )
graphic = button->loadGraphic( graphicSource );
if ( !iconSource.isEmpty() )
icon = button->loadIcon( iconSource );
isGraphicSourceDirty = false;
isIconSourceDirty = false;
}
}
QString text;
QUrl graphicSource;
QskGraphic graphic;
QUrl iconSource;
QskGraphic icon;
bool isCheckable : 1;
bool isGraphicSourceDirty : 1;
bool isIconSourceDirty : 1;
int emphasis : 4;
};
@ -153,13 +153,13 @@ QFont QskPushButton::font() const
return effectiveFont( Text );
}
void QskPushButton::resetGraphicStrutSize()
void QskPushButton::resetIconStrutSize()
{
if ( resetStrutSizeHint( Graphic ) )
Q_EMIT graphicStrutSizeChanged();
if ( resetStrutSizeHint( Icon ) )
Q_EMIT iconStrutSizeChanged();
}
void QskPushButton::setGraphicStrutSize( const QSizeF& size )
void QskPushButton::setIconStrutSize( const QSizeF& size )
{
auto newSize = size;
if ( newSize.width() < 0.0 )
@ -168,57 +168,57 @@ void QskPushButton::setGraphicStrutSize( const QSizeF& size )
if ( newSize.height() < 0.0 )
newSize.setHeight( -1.0 );
if ( setStrutSizeHint( Graphic, newSize ) )
Q_EMIT graphicStrutSizeChanged();
if ( setStrutSizeHint( Icon, newSize ) )
Q_EMIT iconStrutSizeChanged();
}
QSizeF QskPushButton::graphicStrutSize() const
QSizeF QskPushButton::iconStrutSize() const
{
return strutSizeHint( Graphic );
return strutSizeHint( Icon );
}
void QskPushButton::setGraphicSource( const QUrl& url )
void QskPushButton::setIconSource( const QUrl& url )
{
if ( m_data->graphicSource == url )
if ( m_data->iconSource == url )
return;
m_data->graphicSource = url;
m_data->graphic.reset();
m_data->iconSource = url;
m_data->icon.reset();
m_data->isGraphicSourceDirty = true;
m_data->isIconSourceDirty = true;
resetImplicitSize();
polish();
update();
Q_EMIT graphicSourceChanged();
Q_EMIT iconSourceChanged();
}
void QskPushButton::setGraphicSource( const QString& source )
void QskPushButton::setIconSource( const QString& source )
{
setGraphicSource( QUrl( source ) );
setIconSource( QUrl( source ) );
}
QUrl QskPushButton::graphicSource() const
QUrl QskPushButton::iconSource() const
{
return m_data->graphicSource;
return m_data->iconSource;
}
void QskPushButton::setGraphic( const QskGraphic& graphic )
void QskPushButton::setIcon( const QskGraphic& icon )
{
if ( graphic != m_data->graphic )
if ( icon != m_data->icon )
{
m_data->graphic = graphic;
m_data->icon = icon;
if ( !m_data->graphicSource.isEmpty() )
if ( !m_data->iconSource.isEmpty() )
{
m_data->graphicSource = QString();
m_data->isGraphicSourceDirty = false;
m_data->iconSource = QString();
m_data->isIconSourceDirty = false;
Q_EMIT graphicSourceChanged();
Q_EMIT iconSourceChanged();
}
Q_EMIT graphicChanged();
Q_EMIT iconChanged();
resetImplicitSize();
polish();
@ -226,20 +226,20 @@ void QskPushButton::setGraphic( const QskGraphic& graphic )
}
}
QskGraphic QskPushButton::graphic() const
QskGraphic QskPushButton::icon() const
{
m_data->ensureGraphic( this );
return m_data->graphic;
m_data->ensureIcon( this );
return m_data->icon;
}
bool QskPushButton::hasGraphic() const
bool QskPushButton::hasIcon() const
{
return !( graphic().isEmpty() && graphicSource().isEmpty() );
return !( icon().isEmpty() && iconSource().isEmpty() );
}
void QskPushButton::updateResources()
{
m_data->ensureGraphic( this );
m_data->ensureIcon( this );
}
QskAspect::Variation QskPushButton::effectiveVariation() const
@ -274,11 +274,11 @@ void QskPushButton::changeEvent( QEvent* event )
{
case QEvent::StyleChange:
{
if ( !m_data->graphicSource.isEmpty() &&
if ( !m_data->iconSource.isEmpty() &&
qskSetup->skin()->hasGraphicProvider() )
{
// we might need to reload from a different skin
m_data->isGraphicSourceDirty = true;
m_data->isIconSourceDirty = true;
}
break;
}
@ -313,7 +313,7 @@ void QskPushButton::mousePressEvent( QMouseEvent* event )
}
}
QskGraphic QskPushButton::loadGraphic( const QUrl& url ) const
QskGraphic QskPushButton::loadIcon( const QUrl& url ) const
{
return Qsk::loadGraphic( url );
}

View File

@ -23,15 +23,15 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
Q_PROPERTY( QskTextOptions textOptions READ textOptions
WRITE setTextOptions RESET resetTextOptions NOTIFY textOptionsChanged )
Q_PROPERTY( QUrl graphicSource READ graphicSource
WRITE setGraphicSource NOTIFY graphicSourceChanged FINAL )
Q_PROPERTY( QUrl iconSource READ iconSource
WRITE setIconSource NOTIFY iconSourceChanged FINAL )
Q_PROPERTY( QskGraphic graphic READ graphic
WRITE setGraphic NOTIFY graphicChanged FINAL )
Q_PROPERTY( QskGraphic icon READ icon
WRITE setIcon NOTIFY iconChanged FINAL )
Q_PROPERTY( QSizeF graphicStrutSize READ graphicStrutSize
WRITE setGraphicStrutSize RESET resetGraphicStrutSize
NOTIFY graphicStrutSizeChanged FINAL )
Q_PROPERTY( QSizeF iconStrutSize READ iconStrutSize
WRITE setIconStrutSize RESET resetIconStrutSize
NOTIFY iconStrutSizeChanged FINAL )
Q_PROPERTY( bool checkable READ isCheckable
WRITE setCheckable NOTIFY checkableChanged FINAL )
@ -45,7 +45,7 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
using Inherited = QskAbstractButton;
public:
QSK_SUBCONTROLS( Panel, Splash, Text, Graphic )
QSK_SUBCONTROLS( Panel, Splash, Text, Icon )
enum Emphasis
{
@ -78,13 +78,13 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
QskTextOptions textOptions() const;
void resetTextOptions();
void setGraphicStrutSize( const QSizeF& );
QSizeF graphicStrutSize() const;
void resetGraphicStrutSize();
void setIconStrutSize( const QSizeF& );
QSizeF iconStrutSize() const;
void resetIconStrutSize();
QUrl graphicSource() const;
QskGraphic graphic() const;
bool hasGraphic() const;
QUrl iconSource() const;
QskGraphic icon() const;
bool hasIcon() const;
QFont font() const;
@ -93,9 +93,9 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
public Q_SLOTS:
void setText( const QString& );
void setGraphicSource( const QUrl& );
void setGraphicSource( const QString& );
void setGraphic( const QskGraphic& );
void setIconSource( const QUrl& );
void setIconSource( const QString& );
void setIcon( const QskGraphic& );
Q_SIGNALS:
void checkableChanged( bool );
@ -105,16 +105,16 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
void textChanged();
void textOptionsChanged();
void graphicChanged();
void graphicSourceChanged();
void graphicStrutSizeChanged();
void iconChanged();
void iconSourceChanged();
void iconStrutSizeChanged();
protected:
void changeEvent( QEvent* ) override;
void mousePressEvent( QMouseEvent* ) override;
void updateResources() override;
virtual QskGraphic loadGraphic( const QUrl& ) const;
virtual QskGraphic loadIcon( const QUrl& ) const;
private:
class PrivateData;

View File

@ -37,7 +37,7 @@ namespace
setGraphicTextElements( button,
QskPushButton::Text, button->text(),
QskPushButton::Graphic, button->graphic().defaultSize() );
QskPushButton::Icon, button->icon().defaultSize() );
const auto alignment = button->alignmentHint(
QskPushButton::Panel, Qt::AlignCenter );
@ -50,7 +50,7 @@ namespace
QskPushButtonSkinlet::QskPushButtonSkinlet( QskSkin* skin )
: Inherited( skin )
{
setNodeRoles( { PanelRole, SplashRole, GraphicRole, TextRole } );
setNodeRoles( { PanelRole, SplashRole, IconRole, TextRole } );
}
QskPushButtonSkinlet::~QskPushButtonSkinlet() = default;
@ -68,7 +68,7 @@ QRectF QskPushButtonSkinlet::subControlRect( const QskSkinnable* skinnable,
if ( subControl == Q::Splash )
return splashRect( button, contentsRect );
if ( ( subControl == Q::Text ) || ( subControl == Q::Graphic ) )
if ( ( subControl == Q::Text ) || ( subControl == Q::Icon ) )
{
const auto r = button->subControlContentsRect( contentsRect, Q::Panel );
@ -99,8 +99,8 @@ QSGNode* QskPushButtonSkinlet::updateSubNode(
case TextRole:
return updateTextNode( button, node );
case GraphicRole:
return updateGraphicNode( button, node, button->graphic(), Q::Graphic );
case IconRole:
return updateGraphicNode( button, node, button->icon(), Q::Icon );
}
return Inherited::updateSubNode( skinnable, nodeRole, node );

View File

@ -22,7 +22,7 @@ class QSK_EXPORT QskPushButtonSkinlet : public QskSkinlet
PanelRole,
SplashRole,
TextRole,
GraphicRole,
IconRole,
RoleCount
};

View File

@ -21,7 +21,7 @@ QSK_SUBCONTROL( QskSegmentedBar, Segment )
QSK_SUBCONTROL( QskSegmentedBar, Separator )
QSK_SUBCONTROL( QskSegmentedBar, Cursor )
QSK_SUBCONTROL( QskSegmentedBar, Text )
QSK_SUBCONTROL( QskSegmentedBar, Graphic )
QSK_SUBCONTROL( QskSegmentedBar, Icon )
QSK_SYSTEM_STATE( QskSegmentedBar, Selected, QskAspect::FirstSystemState << 1 )
QSK_SYSTEM_STATE( QskSegmentedBar, Minimum, QskAspect::FirstSystemState << 2 )

View File

@ -32,7 +32,7 @@ class QSK_EXPORT QskSegmentedBar : public QskControl
using Inherited = QskControl;
public:
QSK_SUBCONTROLS( Panel, Segment, Separator, Cursor, Text, Graphic )
QSK_SUBCONTROLS( Panel, Segment, Separator, Cursor, Text, Icon )
QSK_STATES( Selected, Minimum, Maximum )
QskSegmentedBar( QQuickItem* parent = nullptr );

View File

@ -40,7 +40,7 @@ namespace
}
#endif
QskGraphic graphicAt( const QskSegmentedBar* bar, const int index )
QskGraphic iconAt( const QskSegmentedBar* bar, const int index )
{
using Q = QskSegmentedBar;
@ -48,9 +48,9 @@ namespace
{
// f.e Material 3 replaces the icon of the selected element by a checkmark
const auto graphic = bar->symbolHint( Q::Graphic | Q::Selected );
if ( !graphic.isNull() )
return graphic;
const auto icon = bar->symbolHint( Q::Icon | Q::Selected );
if ( !icon.isNull() )
return icon;
}
return qskValueAt< QskGraphic >( bar, index );
@ -68,7 +68,7 @@ namespace
setGraphicTextElements( bar,
Q::Text, qskValueAt< QString >( bar, index ),
Q::Graphic, graphicAt( bar, index ).defaultSize() );
Q::Icon, iconAt( bar, index ).defaultSize() );
if( bar->orientation() == Qt::Horizontal )
{
@ -83,7 +83,7 @@ QskSegmentedBarSkinlet::QskSegmentedBarSkinlet( QskSkin* skin )
: Inherited( skin )
{
setNodeRoles( { PanelRole, SegmentRole,
SeparatorRole, CursorRole, TextRole, GraphicRole } );
SeparatorRole, CursorRole, TextRole, IconRole } );
}
QskSegmentedBarSkinlet::~QskSegmentedBarSkinlet() = default;
@ -216,8 +216,8 @@ QSGNode* QskSegmentedBarSkinlet::updateSubNode(
case TextRole:
return updateSeriesNode( skinnable, Q::Text, node );
case GraphicRole:
return updateSeriesNode( skinnable, Q::Graphic, node );
case IconRole:
return updateSeriesNode( skinnable, Q::Icon, node );
}
return nullptr;
@ -230,7 +230,7 @@ QSizeF QskSegmentedBarSkinlet::segmentSizeHint(
QSizeF sizeMax;
const auto graphic0 = bar->symbolHint( Q::Graphic | Q::Selected );
const auto graphic0 = bar->symbolHint( Q::Icon | Q::Selected );
for ( int i = 0; i < bar->count(); i++ )
{
@ -242,7 +242,7 @@ QSizeF QskSegmentedBarSkinlet::segmentSizeHint(
layoutEngine.setGraphicTextElements( bar,
Q::Text, qskValueAt< QString >( bar, i ),
Q::Graphic, graphic.defaultSize() );
Q::Icon, graphic.defaultSize() );
const auto size = layoutEngine.sizeHint( which, QSizeF() );
@ -318,7 +318,7 @@ QRectF QskSegmentedBarSkinlet::sampleRect( const QskSkinnable* skinnable,
return separatorRect( bar, contentsRect, index );
}
if ( subControl == Q::Text || subControl == Q::Graphic )
if ( subControl == Q::Text || subControl == Q::Icon )
{
const auto rect = sampleRect( skinnable, contentsRect, Q::Segment, index );
@ -337,7 +337,7 @@ QskAspect::States QskSegmentedBarSkinlet::sampleStates(
auto states = Inherited::sampleStates( skinnable, subControl, index );
if ( subControl == Q::Segment || subControl == Q::Graphic || subControl == Q::Text )
if ( subControl == Q::Segment || subControl == Q::Icon || subControl == Q::Text )
{
const auto bar = static_cast< const QskSegmentedBar* >( skinnable );
@ -384,14 +384,14 @@ QSGNode* QskSegmentedBarSkinlet::updateSampleNode( const QskSkinnable* skinnable
return nullptr;
}
if ( subControl == Q::Graphic )
if ( subControl == Q::Icon )
{
const auto graphic = graphicAt( bar, index );
const auto graphic = iconAt( bar, index );
if( !graphic.isEmpty() )
{
const auto filter = bar->effectiveGraphicFilter( subControl );
const auto padding = bar->paddingHint( Q::Graphic );
const auto padding = bar->paddingHint( Q::Icon );
const auto graphicRect = rect.marginsRemoved( padding );
return QskSkinlet::updateGraphicNode(

View File

@ -25,7 +25,7 @@ class QSK_EXPORT QskSegmentedBarSkinlet : public QskSkinlet
CursorRole,
TextRole,
GraphicRole,
IconRole,
RoleCount
};