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:
parent
3b88f7cd61
commit
484780a40e
|
|
@ -87,7 +87,7 @@ Qsk.Window
|
||||||
TestButton
|
TestButton
|
||||||
{
|
{
|
||||||
text: "Check Me"
|
text: "Check Me"
|
||||||
graphicSource: "image://shapes/Ring/Khaki"
|
iconSource: "image://shapes/Ring/Khaki"
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
}
|
}
|
||||||
|
|
@ -117,11 +117,11 @@ Qsk.Window
|
||||||
|
|
||||||
TestButton
|
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
|
width: -1
|
||||||
height : -1
|
height : -1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,18 +46,18 @@ namespace
|
||||||
void populate()
|
void populate()
|
||||||
{
|
{
|
||||||
auto* filledButton1 = new QskPushButton( this );
|
auto* filledButton1 = new QskPushButton( this );
|
||||||
filledButton1->setGraphicSource( "airport_shuttle" );
|
filledButton1->setIconSource( "airport_shuttle" );
|
||||||
filledButton1->setText( "normal" );
|
filledButton1->setText( "normal" );
|
||||||
|
|
||||||
auto* filledButton2 = new QskPushButton( this );
|
auto* filledButton2 = new QskPushButton( this );
|
||||||
filledButton2->setText( "normal" );
|
filledButton2->setText( "normal" );
|
||||||
|
|
||||||
auto* filledButton3 = new QskPushButton( this );
|
auto* filledButton3 = new QskPushButton( this );
|
||||||
filledButton3->setGraphicSource( "airport_shuttle" );
|
filledButton3->setIconSource( "airport_shuttle" );
|
||||||
|
|
||||||
|
|
||||||
auto* checkableButton1 = new QskPushButton( this );
|
auto* checkableButton1 = new QskPushButton( this );
|
||||||
checkableButton1->setGraphicSource( "airport_shuttle" );
|
checkableButton1->setIconSource( "airport_shuttle" );
|
||||||
checkableButton1->setText( "checkable" );
|
checkableButton1->setText( "checkable" );
|
||||||
checkableButton1->setCheckable( true );
|
checkableButton1->setCheckable( true );
|
||||||
|
|
||||||
|
|
@ -66,13 +66,13 @@ namespace
|
||||||
checkableButton2->setCheckable( true );
|
checkableButton2->setCheckable( true );
|
||||||
|
|
||||||
auto* checkableButton3 = new QskPushButton( this );
|
auto* checkableButton3 = new QskPushButton( this );
|
||||||
checkableButton3->setGraphicSource( "airport_shuttle" );
|
checkableButton3->setIconSource( "airport_shuttle" );
|
||||||
checkableButton3->setCheckable( true );
|
checkableButton3->setCheckable( true );
|
||||||
|
|
||||||
|
|
||||||
auto* outlinedButton1 = new QskPushButton( this );
|
auto* outlinedButton1 = new QskPushButton( this );
|
||||||
outlinedButton1->setEmphasis( QskPushButton::LowEmphasis );
|
outlinedButton1->setEmphasis( QskPushButton::LowEmphasis );
|
||||||
outlinedButton1->setGraphicSource( "flight" );
|
outlinedButton1->setIconSource( "flight" );
|
||||||
outlinedButton1->setText( "low emphasis" );
|
outlinedButton1->setText( "low emphasis" );
|
||||||
|
|
||||||
auto* outlinedButton2 = new QskPushButton( this );
|
auto* outlinedButton2 = new QskPushButton( this );
|
||||||
|
|
@ -81,12 +81,12 @@ namespace
|
||||||
|
|
||||||
auto* outlinedButton3 = new QskPushButton( this );
|
auto* outlinedButton3 = new QskPushButton( this );
|
||||||
outlinedButton3->setEmphasis( QskPushButton::LowEmphasis );
|
outlinedButton3->setEmphasis( QskPushButton::LowEmphasis );
|
||||||
outlinedButton3->setGraphicSource( "flight" );
|
outlinedButton3->setIconSource( "flight" );
|
||||||
|
|
||||||
|
|
||||||
auto* textButton1 = new QskPushButton( this );
|
auto* textButton1 = new QskPushButton( this );
|
||||||
textButton1->setEmphasis( QskPushButton::VeryLowEmphasis );
|
textButton1->setEmphasis( QskPushButton::VeryLowEmphasis );
|
||||||
textButton1->setGraphicSource( "local_pizza" );
|
textButton1->setIconSource( "local_pizza" );
|
||||||
textButton1->setText( "very low emphasis" );
|
textButton1->setText( "very low emphasis" );
|
||||||
|
|
||||||
auto* textButton2 = new QskPushButton( this );
|
auto* textButton2 = new QskPushButton( this );
|
||||||
|
|
@ -95,12 +95,12 @@ namespace
|
||||||
|
|
||||||
auto* textButton3 = new QskPushButton( this );
|
auto* textButton3 = new QskPushButton( this );
|
||||||
textButton3->setEmphasis( QskPushButton::VeryLowEmphasis );
|
textButton3->setEmphasis( QskPushButton::VeryLowEmphasis );
|
||||||
textButton3->setGraphicSource( "local_pizza" );
|
textButton3->setIconSource( "local_pizza" );
|
||||||
|
|
||||||
|
|
||||||
auto* elevatedButton1 = new QskPushButton( this );
|
auto* elevatedButton1 = new QskPushButton( this );
|
||||||
elevatedButton1->setEmphasis( QskPushButton::HighEmphasis );
|
elevatedButton1->setEmphasis( QskPushButton::HighEmphasis );
|
||||||
elevatedButton1->setGraphicSource( "plus" );
|
elevatedButton1->setIconSource( "plus" );
|
||||||
elevatedButton1->setText( "high emphasis" );
|
elevatedButton1->setText( "high emphasis" );
|
||||||
|
|
||||||
auto* elevatedButton2 = new QskPushButton( this );
|
auto* elevatedButton2 = new QskPushButton( this );
|
||||||
|
|
@ -109,12 +109,12 @@ namespace
|
||||||
|
|
||||||
auto* elevatedButton3 = new QskPushButton( this );
|
auto* elevatedButton3 = new QskPushButton( this );
|
||||||
elevatedButton3->setEmphasis( QskPushButton::HighEmphasis );
|
elevatedButton3->setEmphasis( QskPushButton::HighEmphasis );
|
||||||
elevatedButton3->setGraphicSource( "plus" );
|
elevatedButton3->setIconSource( "plus" );
|
||||||
|
|
||||||
|
|
||||||
auto* tonalButton1 = new QskPushButton( this );
|
auto* tonalButton1 = new QskPushButton( this );
|
||||||
tonalButton1->setEmphasis( QskPushButton::VeryHighEmphasis );
|
tonalButton1->setEmphasis( QskPushButton::VeryHighEmphasis );
|
||||||
tonalButton1->setGraphicSource( "sports_soccer" );
|
tonalButton1->setIconSource( "sports_soccer" );
|
||||||
tonalButton1->setText( "very high emphasis" );
|
tonalButton1->setText( "very high emphasis" );
|
||||||
|
|
||||||
auto* tonalButton2 = new QskPushButton( this );
|
auto* tonalButton2 = new QskPushButton( this );
|
||||||
|
|
@ -123,7 +123,7 @@ namespace
|
||||||
|
|
||||||
auto* tonalButton3 = new QskPushButton( this );
|
auto* tonalButton3 = new QskPushButton( this );
|
||||||
tonalButton3->setEmphasis( QskPushButton::VeryHighEmphasis );
|
tonalButton3->setEmphasis( QskPushButton::VeryHighEmphasis );
|
||||||
tonalButton3->setGraphicSource( "sports_soccer" );
|
tonalButton3->setIconSource( "sports_soccer" );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ BoxWithButtons::BoxWithButtons(
|
||||||
layout->setSpacing( 20 );
|
layout->setSpacing( 20 );
|
||||||
|
|
||||||
auto iconLabel = new RoundedIcon( isBright, layout );
|
auto iconLabel = new RoundedIcon( isBright, layout );
|
||||||
iconLabel->setGraphicSource( title );
|
iconLabel->setIconSource( title );
|
||||||
iconLabel->setGraphicStrutSize( { 35.17, 35.17 } );
|
iconLabel->setIconStrutSize( { 35.17, 35.17 } );
|
||||||
iconLabel->setFixedSize( 68, 68 );
|
iconLabel->setFixedSize( 68, 68 );
|
||||||
|
|
||||||
auto titleAndValue = new QskLinearBox( Qt::Vertical, layout );
|
auto titleAndValue = new QskLinearBox( Qt::Vertical, layout );
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
QSK_SUBCONTROL( MenuBarTopLabel, Graphic )
|
QSK_SUBCONTROL( MenuBarTopLabel, Icon )
|
||||||
|
|
||||||
QSK_SUBCONTROL( MenuButton, Panel )
|
QSK_SUBCONTROL( MenuButton, Panel )
|
||||||
QSK_SUBCONTROL( MenuButton, Text )
|
QSK_SUBCONTROL( MenuButton, Text )
|
||||||
QSK_SUBCONTROL( MenuButton, Graphic )
|
QSK_SUBCONTROL( MenuButton, Icon )
|
||||||
|
|
||||||
QSK_SUBCONTROL( MenuBar, Panel )
|
QSK_SUBCONTROL( MenuBar, Panel )
|
||||||
|
|
||||||
|
|
@ -23,9 +23,9 @@ MenuButton::MenuButton( const QString& name, QQuickItem* parent )
|
||||||
|
|
||||||
setSubcontrolProxy( QskPushButton::Panel, MenuButton::Panel );
|
setSubcontrolProxy( QskPushButton::Panel, MenuButton::Panel );
|
||||||
setSubcontrolProxy( QskPushButton::Text, MenuButton::Text );
|
setSubcontrolProxy( QskPushButton::Text, MenuButton::Text );
|
||||||
setSubcontrolProxy( QskPushButton::Graphic, MenuButton::Graphic );
|
setSubcontrolProxy( QskPushButton::Icon, MenuButton::Icon );
|
||||||
|
|
||||||
setGraphicSource( name );
|
setIconSource( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuBar::MenuBar( QQuickItem* parent )
|
MenuBar::MenuBar( QQuickItem* parent )
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class MenuBarTopLabel final : public QskGraphicLabel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Graphic )
|
QSK_SUBCONTROLS( Icon )
|
||||||
|
|
||||||
MenuBarTopLabel( const QString& icon, QQuickItem* parent = nullptr )
|
MenuBarTopLabel( const QString& icon, QQuickItem* parent = nullptr )
|
||||||
: QskGraphicLabel( icon, parent )
|
: QskGraphicLabel( icon, parent )
|
||||||
|
|
@ -31,7 +31,7 @@ class MenuButton final : public QskPushButton
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Text, Graphic )
|
QSK_SUBCONTROLS( Panel, Text, Icon )
|
||||||
|
|
||||||
MenuButton( const QString& name, QQuickItem* parent );
|
MenuButton( const QString& name, QQuickItem* parent );
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ namespace
|
||||||
|
|
||||||
auto icon = new RoundedIcon( isBright, this );
|
auto icon = new RoundedIcon( isBright, this );
|
||||||
icon->setPale( true );
|
icon->setPale( true );
|
||||||
icon->setGraphicSource( name );
|
icon->setIconSource( name );
|
||||||
icon->setGraphicStrutSize( { 36, 36 } );
|
icon->setIconStrutSize( { 36, 36 } );
|
||||||
icon->setFixedSize( 68, 68 );
|
icon->setFixedSize( 68, 68 );
|
||||||
icon->setCheckable( true );
|
icon->setCheckable( true );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,14 @@ RoundButton::RoundButton( Qt::Edge edge, QQuickItem* parent )
|
||||||
if( edge == Qt::TopEdge )
|
if( edge == Qt::TopEdge )
|
||||||
{
|
{
|
||||||
setSkinStateFlag( Top );
|
setSkinStateFlag( Top );
|
||||||
setGraphicSource( "up" );
|
setIconSource( "up" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setGraphicSource( "down" );
|
setIconSource( "down" );
|
||||||
}
|
}
|
||||||
|
|
||||||
setGraphicStrutSize( graphic().defaultSize() * 1.2 );
|
setIconStrutSize( icon().defaultSize() * 1.2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_RoundButton.cpp"
|
#include "moc_RoundButton.cpp"
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ RoundedIcon::RoundedIcon( bool isBright, QQuickItem* parent )
|
||||||
|
|
||||||
setPale( false );
|
setPale( false );
|
||||||
|
|
||||||
setSubcontrolProxy( QskPushButton::Graphic, Graphic );
|
setSubcontrolProxy( QskPushButton::Icon, Icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoundedIcon::setPale( bool on )
|
void RoundedIcon::setPale( bool on )
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,9 @@ void Skin::initHints( const Palette& palette )
|
||||||
ed.setFontRole( MenuButton::Text, QskSkin::SmallFont );
|
ed.setFontRole( MenuButton::Text, QskSkin::SmallFont );
|
||||||
ed.setAlignment( MenuButton::Text, Qt::AlignLeft | Qt::AlignVCenter );
|
ed.setAlignment( MenuButton::Text, Qt::AlignLeft | Qt::AlignVCenter );
|
||||||
|
|
||||||
ed.setPadding( MenuButton::Graphic, { 30, 0, 0, 0 } );
|
ed.setPadding( MenuButton::Icon, { 30, 0, 0, 0 } );
|
||||||
ed.setStrutSize( MenuButton::Graphic, { 14, -1 } );
|
ed.setStrutSize( MenuButton::Icon, { 14, -1 } );
|
||||||
ed.setAlignment( MenuButton::Graphic, Qt::AlignCenter );
|
ed.setAlignment( MenuButton::Icon, Qt::AlignCenter );
|
||||||
|
|
||||||
|
|
||||||
// top bar:
|
// top bar:
|
||||||
|
|
|
||||||
|
|
@ -106,12 +106,12 @@ class MySkinEditor : public QskSkinHintTableEditor
|
||||||
setAnimation( subControl | A::Color, animator() );
|
setAnimation( subControl | A::Color, animator() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto subControl : { Q::UncheckedGraphic, Q::CheckedGraphic } )
|
for( auto subControl : { Q::UncheckedIcon, Q::CheckedIcon } )
|
||||||
{
|
{
|
||||||
int role1 = MySkin::GraphicRoleInverted;
|
int role1 = MySkin::GraphicRoleInverted;
|
||||||
int role2 = MySkin::GraphicRoleNormal;
|
int role2 = MySkin::GraphicRoleNormal;
|
||||||
|
|
||||||
if( subControl == Q::CheckedGraphic )
|
if( subControl == Q::CheckedIcon )
|
||||||
std::swap( role1, role2 );
|
std::swap( role1, role2 );
|
||||||
|
|
||||||
setGraphicRole( subControl, role1 );
|
setGraphicRole( subControl, role1 );
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ QSK_SUBCONTROL( MyToggleButton, CheckedPanel )
|
||||||
QSK_SUBCONTROL( MyToggleButton, CheckedText )
|
QSK_SUBCONTROL( MyToggleButton, CheckedText )
|
||||||
QSK_SUBCONTROL( MyToggleButton, UncheckedPanel )
|
QSK_SUBCONTROL( MyToggleButton, UncheckedPanel )
|
||||||
QSK_SUBCONTROL( MyToggleButton, UncheckedText )
|
QSK_SUBCONTROL( MyToggleButton, UncheckedText )
|
||||||
QSK_SUBCONTROL( MyToggleButton, CheckedGraphic )
|
QSK_SUBCONTROL( MyToggleButton, CheckedIcon )
|
||||||
QSK_SUBCONTROL( MyToggleButton, UncheckedGraphic )
|
QSK_SUBCONTROL( MyToggleButton, UncheckedIcon )
|
||||||
|
|
||||||
class MyToggleButton::PrivateData
|
class MyToggleButton::PrivateData
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ class MyToggleButton : public QskAbstractButton
|
||||||
using Inherited = QskAbstractButton;
|
using Inherited = QskAbstractButton;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Cursor, CheckedPanel, CheckedText, CheckedGraphic,
|
QSK_SUBCONTROLS( Panel, Cursor, CheckedPanel, CheckedText, CheckedIcon,
|
||||||
UncheckedPanel, UncheckedText, UncheckedGraphic )
|
UncheckedPanel, UncheckedText, UncheckedIcon )
|
||||||
|
|
||||||
MyToggleButton( QQuickItem* parent = nullptr );
|
MyToggleButton( QQuickItem* parent = nullptr );
|
||||||
~MyToggleButton() override;
|
~MyToggleButton() override;
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,11 @@ QRectF MyToggleButtonSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||||
const auto r = button->subControlContentsRect( contentsRect, Q::Panel );
|
const auto r = button->subControlContentsRect( contentsRect, Q::Panel );
|
||||||
return sectionRect( r, button->isInverted() ? 0 : 1 );
|
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 );
|
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 );
|
return button->subControlContentsRect( contentsRect, Q::UncheckedPanel );
|
||||||
}
|
}
|
||||||
|
|
@ -109,13 +109,13 @@ QSGNode* MyToggleButtonSkinlet::updateSubNode(
|
||||||
case CheckedGraphicRole:
|
case CheckedGraphicRole:
|
||||||
{
|
{
|
||||||
return updateGraphicNode(
|
return updateGraphicNode(
|
||||||
button, node, button->graphic( true ), Q::CheckedGraphic );
|
button, node, button->graphic( true ), Q::CheckedIcon );
|
||||||
}
|
}
|
||||||
|
|
||||||
case UncheckedGraphicRole:
|
case UncheckedGraphicRole:
|
||||||
{
|
{
|
||||||
return updateGraphicNode(
|
return updateGraphicNode(
|
||||||
button, node, button->graphic( false ), Q::UncheckedGraphic );
|
button, node, button->graphic( false ), Q::UncheckedIcon );
|
||||||
}
|
}
|
||||||
|
|
||||||
case CursorRole:
|
case CursorRole:
|
||||||
|
|
|
||||||
|
|
@ -72,11 +72,11 @@ class Thumbnail : public QskPushButton
|
||||||
{
|
{
|
||||||
const QSizeF size( thumbnailSize, thumbnailSize );
|
const QSizeF size( thumbnailSize, thumbnailSize );
|
||||||
|
|
||||||
setGraphic( thumbnailGraphic( color, shape, size ) );
|
setIcon( thumbnailGraphic( color, shape, size ) );
|
||||||
setFixedSize( size );
|
setFixedSize( size );
|
||||||
|
|
||||||
setBoxShapeHint( QskPushButton::Panel, QskBoxShapeMetrics( 20, Qt::RelativeSize ) );
|
setBoxShapeHint( QskPushButton::Panel, QskBoxShapeMetrics( 20, Qt::RelativeSize ) );
|
||||||
setStrutSizeHint( QskPushButton::Graphic, -1, -1 );
|
setStrutSizeHint( QskPushButton::Icon, -1, -1 );
|
||||||
|
|
||||||
setSection( QskAspect::Header ); // to make them flat
|
setSection( QskAspect::Header ); // to make them flat
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -294,29 +294,29 @@ void Editor::setupComboBox()
|
||||||
m_pal.surfaceVariant, m_pal.pressedOpacity );
|
m_pal.surfaceVariant, m_pal.pressedOpacity );
|
||||||
setGradient( Q::Panel | Q::PopupOpen, activeColor );
|
setGradient( Q::Panel | Q::PopupOpen, activeColor );
|
||||||
|
|
||||||
setStrutSize( Q::Graphic, 24_dp, 24_dp );
|
setStrutSize( Q::Icon, 24_dp, 24_dp );
|
||||||
setGraphicRole( Q::Graphic, QskMaterial3Skin::GraphicRoleOnSurface );
|
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleOnSurface );
|
||||||
|
|
||||||
setColor( Q::Text, m_pal.onSurface );
|
setColor( Q::Text, m_pal.onSurface );
|
||||||
setFontRole( Q::Text, QskMaterial3Skin::M3BodyMedium );
|
setFontRole( Q::Text, QskMaterial3Skin::M3BodyMedium );
|
||||||
|
|
||||||
setStrutSize( Q::PopupIndicator, 12_dp, 12_dp );
|
setStrutSize( Q::StatusIndicator, 12_dp, 12_dp );
|
||||||
setGraphicRole( Q::PopupIndicator, QskMaterial3Skin::GraphicRoleOnSurface );
|
setGraphicRole( Q::StatusIndicator, QskMaterial3Skin::GraphicRoleOnSurface );
|
||||||
setAlignment( Q::PopupIndicator, Qt::AlignRight | Qt::AlignVCenter );
|
setAlignment( Q::StatusIndicator, Qt::AlignRight | Qt::AlignVCenter );
|
||||||
|
|
||||||
|
|
||||||
const auto disabledPanelColor = QskRgb::toTransparentF( m_pal.onSurface, 0.04 );
|
const auto disabledPanelColor = QskRgb::toTransparentF( m_pal.onSurface, 0.04 );
|
||||||
setGradient( Q::Panel | Q::Disabled, disabledPanelColor );
|
setGradient( Q::Panel | Q::Disabled, disabledPanelColor );
|
||||||
setBoxBorderColors( Q::Panel | Q::Disabled, m_pal.onSurface38 );
|
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 );
|
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::StatusIndicator, symbol( "combo-box-arrow-closed" ) );
|
||||||
setSymbol( Q::PopupIndicator | Q::PopupOpen, symbol( "combo-box-arrow-open" ) );
|
setSymbol( Q::StatusIndicator | Q::PopupOpen, symbol( "combo-box-arrow-open" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupBox()
|
void Editor::setupBox()
|
||||||
|
|
@ -369,9 +369,9 @@ void Editor::setupMenu()
|
||||||
|
|
||||||
setGradient( Q::Cursor, m_pal.primary12 );
|
setGradient( Q::Cursor, m_pal.primary12 );
|
||||||
|
|
||||||
setPadding( Q::Graphic, 7_dp );
|
setPadding( Q::Icon, 7_dp );
|
||||||
setStrutSize( Q::Graphic, 24_dp, 24_dp );
|
setStrutSize( Q::Icon, 24_dp, 24_dp );
|
||||||
setGraphicRole( Q::Graphic, QskMaterial3Skin::GraphicRoleOnSurface );
|
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleOnSurface );
|
||||||
|
|
||||||
setColor( Q::Text, m_pal.onSurface );
|
setColor( Q::Text, m_pal.onSurface );
|
||||||
setFontRole( Q::Text, QskMaterial3Skin::M3BodyMedium );
|
setFontRole( Q::Text, QskMaterial3Skin::M3BodyMedium );
|
||||||
|
|
@ -586,15 +586,15 @@ void Editor::setupSegmentedBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Graphic
|
// Icon
|
||||||
|
|
||||||
setSymbol( Q::Graphic, symbol( "segmented-button-check" ) );
|
setSymbol( Q::Icon, symbol( "segmented-button-check" ) );
|
||||||
setStrutSize( Q::Graphic, 18_dp, 18_dp );
|
setStrutSize( Q::Icon, 18_dp, 18_dp );
|
||||||
|
|
||||||
setGraphicRole( Q::Graphic, QskMaterial3Skin::GraphicRoleOnSurface );
|
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleOnSurface );
|
||||||
setGraphicRole( Q::Graphic | Q::Selected,
|
setGraphicRole( Q::Icon | Q::Selected,
|
||||||
QskMaterial3Skin::GraphicRoleOnSecondaryContainer );
|
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 } );
|
setPadding( Q::Panel, { 24_dp, 0, 24_dp, 0 } );
|
||||||
setBoxShape( Q::Panel, 100, Qt::RelativeSize );
|
setBoxShape( Q::Panel, 100, Qt::RelativeSize );
|
||||||
|
|
||||||
setStrutSize( Q::Graphic, 18_dp, 18_dp );
|
setStrutSize( Q::Icon, 18_dp, 18_dp );
|
||||||
setPadding( Q::Graphic, { 0, 0, 8_dp, 0 } );
|
setPadding( Q::Icon, { 0, 0, 8_dp, 0 } );
|
||||||
setGraphicRole( Q::Graphic, QskMaterial3Skin::GraphicRoleOnPrimary );
|
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleOnPrimary );
|
||||||
|
|
||||||
setFontRole( Q::Text, QskMaterial3Skin::M3LabelLarge );
|
setFontRole( Q::Text, QskMaterial3Skin::M3LabelLarge );
|
||||||
setPadding( Q::Text, 0 );
|
setPadding( Q::Text, 0 );
|
||||||
|
|
@ -664,14 +664,14 @@ void Editor::setupPushButton()
|
||||||
setGradient( Q::Panel | M3::Elevated, m_pal.surface1 );
|
setGradient( Q::Panel | M3::Elevated, m_pal.surface1 );
|
||||||
setShadowMetrics( Q::Panel | M3::Elevated, m_pal.elevation1 );
|
setShadowMetrics( Q::Panel | M3::Elevated, m_pal.elevation1 );
|
||||||
setColor( Q::Text | M3::Elevated, m_pal.primary );
|
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,
|
setGradient( Q::Splash | M3::Elevated,
|
||||||
stateLayerColor( m_pal.primary, m_pal.pressedOpacity ) );
|
stateLayerColor( m_pal.primary, m_pal.pressedOpacity ) );
|
||||||
|
|
||||||
setGradient( Q::Panel | M3::Elevated | Q::Disabled, m_pal.onSurface12 );
|
setGradient( Q::Panel | M3::Elevated | Q::Disabled, m_pal.onSurface12 );
|
||||||
setShadowMetrics( Q::Panel | M3::Elevated | Q::Disabled, m_pal.elevation0 );
|
setShadowMetrics( Q::Panel | M3::Elevated | Q::Disabled, m_pal.elevation0 );
|
||||||
setColor( Q::Text | M3::Elevated | Q::Disabled, m_pal.onSurface38 );
|
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 );
|
QskMaterial3Skin::GraphicRoleOnSurface38 );
|
||||||
|
|
||||||
const auto elevatedHoverColor =
|
const auto elevatedHoverColor =
|
||||||
|
|
@ -707,7 +707,7 @@ void Editor::setupPushButton()
|
||||||
|
|
||||||
setColor( Q::Text, m_pal.onPrimary );
|
setColor( Q::Text, m_pal.onPrimary );
|
||||||
setColor( Q::Text | Q::Disabled, m_pal.onSurface38 );
|
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 );
|
setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap );
|
||||||
|
|
||||||
|
|
@ -717,13 +717,13 @@ void Editor::setupPushButton()
|
||||||
setGradient( Q::Panel | M3::Tonal, m_pal.secondaryContainer );
|
setGradient( Q::Panel | M3::Tonal, m_pal.secondaryContainer );
|
||||||
setShadowMetrics( Q::Panel | M3::Tonal, m_pal.elevation0 );
|
setShadowMetrics( Q::Panel | M3::Tonal, m_pal.elevation0 );
|
||||||
setColor( Q::Text | M3::Tonal, m_pal.onSecondaryContainer );
|
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,
|
setGradient( Q::Splash | M3::Tonal,
|
||||||
stateLayerColor( m_pal.onSecondaryContainer, m_pal.pressedOpacity ) );
|
stateLayerColor( m_pal.onSecondaryContainer, m_pal.pressedOpacity ) );
|
||||||
|
|
||||||
setGradient( Q::Panel | M3::Tonal | Q::Disabled, m_pal.onSurface12 );
|
setGradient( Q::Panel | M3::Tonal | Q::Disabled, m_pal.onSurface12 );
|
||||||
setColor( Q::Text | M3::Tonal | Q::Disabled, m_pal.onSurface38 );
|
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 );
|
QskMaterial3Skin::GraphicRoleOnSurface38 );
|
||||||
|
|
||||||
const auto tonalHoverColor = flattenedColor( m_pal.onSecondaryContainer,
|
const auto tonalHoverColor = flattenedColor( m_pal.onSecondaryContainer,
|
||||||
|
|
@ -748,13 +748,13 @@ void Editor::setupPushButton()
|
||||||
setShadowMetrics( Q::Panel | M3::Outlined, m_pal.elevation0 );
|
setShadowMetrics( Q::Panel | M3::Outlined, m_pal.elevation0 );
|
||||||
|
|
||||||
setColor( Q::Text | M3::Outlined, m_pal.primary );
|
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,
|
setGradient( Q::Splash | M3::Outlined,
|
||||||
stateLayerColor( m_pal.outline, m_pal.pressedOpacity ) );
|
stateLayerColor( m_pal.outline, m_pal.pressedOpacity ) );
|
||||||
|
|
||||||
setBoxBorderColors( Q::Panel | M3::Outlined | Q::Disabled, m_pal.onSurface12 );
|
setBoxBorderColors( Q::Panel | M3::Outlined | Q::Disabled, m_pal.onSurface12 );
|
||||||
setColor( Q::Text | M3::Outlined | Q::Disabled, m_pal.onSurface38 );
|
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 );
|
QskMaterial3Skin::GraphicRoleOnSurface38 );
|
||||||
|
|
||||||
setBoxBorderColors( Q::Panel | M3::Outlined | Q::Hovered, m_pal.outline );
|
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 );
|
setShadowMetrics( Q::Panel | M3::Text, m_pal.elevation0 );
|
||||||
setColor( Q::Text | M3::Text, m_pal.primary );
|
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,
|
setGradient( Q::Splash | M3::Text,
|
||||||
stateLayerColor( m_pal.primary, m_pal.pressedOpacity ) );
|
stateLayerColor( m_pal.primary, m_pal.pressedOpacity ) );
|
||||||
|
|
||||||
setColor( Q::Text | M3::Text | Q::Disabled, m_pal.onSurface38 );
|
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 );
|
setGradient( Q::Panel | M3::Text | Q::Hovered, m_pal.primary8 );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -383,17 +383,17 @@ void Editor::setupComboBox()
|
||||||
setBoxBorderColors( Q::Panel, borderColors );
|
setBoxBorderColors( Q::Panel, borderColors );
|
||||||
setGradient( Q::Panel, c );
|
setGradient( Q::Panel, c );
|
||||||
|
|
||||||
setStrutSize( Q::Graphic, 24_dp, 24_dp );
|
setStrutSize( Q::Icon, 24_dp, 24_dp );
|
||||||
setGraphicRole( Q::Graphic | Q::Disabled, DisabledSymbol );
|
setGraphicRole( Q::Icon | Q::Disabled, DisabledSymbol );
|
||||||
|
|
||||||
setStrutSize( Q::PopupIndicator, 15_dp, 15_dp );
|
setStrutSize( Q::StatusIndicator, 15_dp, 15_dp );
|
||||||
setGraphicRole( Q::PopupIndicator | Q::Disabled, DisabledSymbol );
|
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 ) );
|
QskStandardSymbol::graphic( QskStandardSymbol::TriangleDown ) );
|
||||||
setSymbol( Q::PopupIndicator | Q::PopupOpen,
|
setSymbol( Q::StatusIndicator | Q::PopupOpen,
|
||||||
QskStandardSymbol::graphic( QskStandardSymbol::TriangleUp ) );
|
QskStandardSymbol::graphic( QskStandardSymbol::TriangleUp ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -435,9 +435,9 @@ void Editor::setupMenu()
|
||||||
setColor( Q::Text, m_pal.contrastedText );
|
setColor( Q::Text, m_pal.contrastedText );
|
||||||
setColor( Q::Text | Q::Selected, m_pal.highlightedText );
|
setColor( Q::Text | Q::Selected, m_pal.highlightedText );
|
||||||
|
|
||||||
setStrutSize( Q::Graphic, 16, 16 );
|
setStrutSize( Q::Icon, 16, 16 );
|
||||||
setGraphicRole( Q::Graphic | Q::Disabled, DisabledSymbol );
|
setGraphicRole( Q::Icon | Q::Disabled, DisabledSymbol );
|
||||||
setGraphicRole( Q::Graphic | Q::Selected, CursorSymbol );
|
setGraphicRole( Q::Icon | Q::Selected, CursorSymbol );
|
||||||
|
|
||||||
setPosition( Q::Panel, 0 );
|
setPosition( Q::Panel, 0 );
|
||||||
setPosition( Q::Panel | QskPopup::Closed, 1 );
|
setPosition( Q::Panel | QskPopup::Closed, 1 );
|
||||||
|
|
@ -613,11 +613,11 @@ void Editor::setupSegmentedBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Graphic
|
// Icon
|
||||||
|
|
||||||
setGraphicRole( Q::Graphic | Q::Disabled, DisabledSymbol );
|
setGraphicRole( Q::Icon | Q::Disabled, DisabledSymbol );
|
||||||
setGraphicRole( Q::Graphic | Q::Selected, CursorSymbol );
|
setGraphicRole( Q::Icon | Q::Selected, CursorSymbol );
|
||||||
setStrutSize( Q::Graphic, -1, 30_dp );
|
setStrutSize( Q::Icon, -1, 30_dp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -682,8 +682,8 @@ void Editor::setupPushButton()
|
||||||
setColor( Q::Text, m_pal.themeForeground );
|
setColor( Q::Text, m_pal.themeForeground );
|
||||||
setColor( Q::Text | Q::Disabled, m_pal.darker200 );
|
setColor( Q::Text | Q::Disabled, m_pal.darker200 );
|
||||||
|
|
||||||
// Graphic
|
// Icon
|
||||||
setAlignment( Q::Graphic, Qt::AlignCenter );
|
setAlignment( Q::Icon, Qt::AlignCenter );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupRadioBox()
|
void Editor::setupRadioBox()
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@
|
||||||
#include <qquickwindow.h>
|
#include <qquickwindow.h>
|
||||||
|
|
||||||
QSK_SUBCONTROL( QskComboBox, Panel )
|
QSK_SUBCONTROL( QskComboBox, Panel )
|
||||||
QSK_SUBCONTROL( QskComboBox, Graphic )
|
QSK_SUBCONTROL( QskComboBox, Icon )
|
||||||
QSK_SUBCONTROL( QskComboBox, Text )
|
QSK_SUBCONTROL( QskComboBox, Text )
|
||||||
QSK_SUBCONTROL( QskComboBox, PopupIndicator )
|
QSK_SUBCONTROL( QskComboBox, StatusIndicator )
|
||||||
|
|
||||||
QSK_SYSTEM_STATE( QskComboBox, PopupOpen, QskAspect::FirstSystemState << 1 )
|
QSK_SYSTEM_STATE( QskComboBox, PopupOpen, QskAspect::FirstSystemState << 1 )
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ bool QskComboBox::isPopupOpen() const
|
||||||
return hasSkinState( PopupOpen );
|
return hasSkinState( PopupOpen );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskGraphic QskComboBox::graphic() const
|
QskGraphic QskComboBox::icon() const
|
||||||
{
|
{
|
||||||
if( m_data->currentIndex >= 0 )
|
if( m_data->currentIndex >= 0 )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class QSK_EXPORT QskComboBox : public QskControl
|
||||||
using Inherited = QskControl;
|
using Inherited = QskControl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Graphic, Text, PopupIndicator )
|
QSK_SUBCONTROLS( Panel, Icon, Text, StatusIndicator )
|
||||||
QSK_STATES( PopupOpen )
|
QSK_STATES( PopupOpen )
|
||||||
|
|
||||||
QskComboBox( QQuickItem* parent = nullptr );
|
QskComboBox( QQuickItem* parent = nullptr );
|
||||||
|
|
@ -41,14 +41,14 @@ class QSK_EXPORT QskComboBox : public QskControl
|
||||||
void setPopupOpen( bool );
|
void setPopupOpen( bool );
|
||||||
bool isPopupOpen() const;
|
bool isPopupOpen() const;
|
||||||
|
|
||||||
QskGraphic graphic() const;
|
QskGraphic icon() const;
|
||||||
|
|
||||||
void setTextOptions( const QskTextOptions& );
|
void setTextOptions( const QskTextOptions& );
|
||||||
QskTextOptions textOptions() const;
|
QskTextOptions textOptions() const;
|
||||||
|
|
||||||
void addOption( const QString& text );
|
void addOption( const QString& text );
|
||||||
void addOption( const QUrl& graphicSource, const QString& text );
|
void addOption( const QUrl& iconSource, const QString& text );
|
||||||
void addOption( const QString& graphicSource, const QString& text );
|
void addOption( const QString& iconSource, const QString& text );
|
||||||
void addOption( const QskGraphic&, const QString& text );
|
void addOption( const QskGraphic&, const QString& text );
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace
|
||||||
|
|
||||||
setGraphicTextElements( box,
|
setGraphicTextElements( box,
|
||||||
QskComboBox::Text, qskValueAt< QString >( box ),
|
QskComboBox::Text, qskValueAt< QString >( box ),
|
||||||
QskComboBox::Graphic, qskValueAt< QskGraphic >( box ).defaultSize() );
|
QskComboBox::Icon, qskValueAt< QskGraphic >( box ).defaultSize() );
|
||||||
|
|
||||||
const auto alignment = box->alignmentHint(
|
const auto alignment = box->alignmentHint(
|
||||||
QskComboBox::Panel, Qt::AlignLeft );
|
QskComboBox::Panel, Qt::AlignLeft );
|
||||||
|
|
@ -66,7 +66,7 @@ namespace
|
||||||
QskComboBoxSkinlet::QskComboBoxSkinlet( QskSkin* skin )
|
QskComboBoxSkinlet::QskComboBoxSkinlet( QskSkin* skin )
|
||||||
: Inherited( skin )
|
: Inherited( skin )
|
||||||
{
|
{
|
||||||
setNodeRoles( { PanelRole, GraphicRole, TextRole, PopupIndicatorRole } );
|
setNodeRoles( { PanelRole, IconRole, TextRole, StatusIndicatorRole } );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskComboBoxSkinlet::~QskComboBoxSkinlet() = default;
|
QskComboBoxSkinlet::~QskComboBoxSkinlet() = default;
|
||||||
|
|
@ -81,7 +81,7 @@ QRectF QskComboBoxSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||||
if ( subControl == Q::Panel )
|
if ( subControl == Q::Panel )
|
||||||
return contentsRect;
|
return contentsRect;
|
||||||
|
|
||||||
if ( subControl == Q::Text || subControl == Q::Graphic )
|
if ( subControl == Q::Text || subControl == Q::Icon )
|
||||||
{
|
{
|
||||||
const auto r = box->subControlContentsRect( contentsRect, Q::Panel );
|
const auto r = box->subControlContentsRect( contentsRect, Q::Panel );
|
||||||
|
|
||||||
|
|
@ -91,10 +91,10 @@ QRectF QskComboBoxSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||||
return layoutEngine.subControlRect( subControl );
|
return layoutEngine.subControlRect( subControl );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( subControl == Q::PopupIndicator )
|
if( subControl == Q::StatusIndicator )
|
||||||
{
|
{
|
||||||
auto rect = box->innerBox( Q::Panel, contentsRect );
|
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() );
|
rect.setLeft( rect.right() - size.width() );
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
@ -114,14 +114,14 @@ QSGNode* QskComboBoxSkinlet::updateSubNode(
|
||||||
case PanelRole:
|
case PanelRole:
|
||||||
return updateBoxNode( box, node, Q::Panel );
|
return updateBoxNode( box, node, Q::Panel );
|
||||||
|
|
||||||
case GraphicRole:
|
case IconRole:
|
||||||
return updateGraphicNode( box, node, box->graphic(), Q::Graphic );
|
return updateGraphicNode( box, node, box->icon(), Q::Icon );
|
||||||
|
|
||||||
case TextRole:
|
case TextRole:
|
||||||
return updateTextNode( box, node );
|
return updateTextNode( box, node );
|
||||||
|
|
||||||
case PopupIndicatorRole:
|
case StatusIndicatorRole:
|
||||||
return updateSymbolNode( box, node, Q::PopupIndicator );
|
return updateSymbolNode( box, node, Q::StatusIndicator );
|
||||||
}
|
}
|
||||||
|
|
||||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||||
|
|
@ -158,7 +158,7 @@ QSizeF QskComboBoxSkinlet::sizeHint( const QskSkinnable* skinnable,
|
||||||
auto size = layoutEngine.sizeHint( which, QSizeF() );
|
auto size = layoutEngine.sizeHint( which, QSizeF() );
|
||||||
|
|
||||||
const auto spacingHint = box->spacingHint( Q::Panel );
|
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();
|
size.rwidth() += spacingHint + menuGraphicHint.width();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ class QSK_EXPORT QskComboBoxSkinlet : public QskSkinlet
|
||||||
enum NodeRole
|
enum NodeRole
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
GraphicRole,
|
IconRole,
|
||||||
TextRole,
|
TextRole,
|
||||||
PopupIndicatorRole,
|
StatusIndicatorRole,
|
||||||
|
|
||||||
RoleCount
|
RoleCount
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ QSK_SUBCONTROL( QskMenu, Panel )
|
||||||
QSK_SUBCONTROL( QskMenu, Segment )
|
QSK_SUBCONTROL( QskMenu, Segment )
|
||||||
QSK_SUBCONTROL( QskMenu, Cursor )
|
QSK_SUBCONTROL( QskMenu, Cursor )
|
||||||
QSK_SUBCONTROL( QskMenu, Text )
|
QSK_SUBCONTROL( QskMenu, Text )
|
||||||
QSK_SUBCONTROL( QskMenu, Graphic )
|
QSK_SUBCONTROL( QskMenu, Icon )
|
||||||
QSK_SUBCONTROL( QskMenu, Separator )
|
QSK_SUBCONTROL( QskMenu, Separator )
|
||||||
|
|
||||||
QSK_SYSTEM_STATE( QskMenu, Selected, QskAspect::FirstSystemState << 2 )
|
QSK_SYSTEM_STATE( QskMenu, Selected, QskAspect::FirstSystemState << 2 )
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class QSK_EXPORT QskMenu : public QskPopup
|
||||||
using Inherited = QskPopup;
|
using Inherited = QskPopup;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Overlay, Panel, Segment, Cursor, Text, Graphic, Separator )
|
QSK_SUBCONTROLS( Overlay, Panel, Segment, Cursor, Text, Icon, Separator )
|
||||||
QSK_STATES( Selected )
|
QSK_STATES( Selected )
|
||||||
|
|
||||||
QskMenu( QQuickItem* parentItem = nullptr );
|
QskMenu( QQuickItem* parentItem = nullptr );
|
||||||
|
|
@ -51,8 +51,8 @@ class QSK_EXPORT QskMenu : public QskPopup
|
||||||
QskTextOptions textOptions() const;
|
QskTextOptions textOptions() const;
|
||||||
|
|
||||||
// insert, remove, functors, actions
|
// insert, remove, functors, actions
|
||||||
void addOption( const QUrl& graphicSource, const QString& text );
|
void addOption( const QUrl& iconSource, const QString& text );
|
||||||
void addOption( const QString& graphicSource, const QString& text );
|
void addOption( const QString& iconSource, const QString& text );
|
||||||
void addOption( const QskGraphic&, const QString& text );
|
void addOption( const QskGraphic&, const QString& text );
|
||||||
void addOption( const QString& text );
|
void addOption( const QString& text );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ class QskMenuSkinlet::PrivateData
|
||||||
{
|
{
|
||||||
const auto skinlet = menu->effectiveSkinlet();
|
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 qreal textHeight = menu->effectiveFontHeight( QskMenu::Text );
|
||||||
|
|
||||||
const auto h = qMax( hint.height(), textHeight );
|
const auto h = qMax( hint.height(), textHeight );
|
||||||
|
|
@ -141,7 +141,7 @@ class QskMenuSkinlet::PrivateData
|
||||||
qreal maxW = 0.0;
|
qreal maxW = 0.0;
|
||||||
for ( int i = 0; i < menu->count(); i++ )
|
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 >() )
|
if ( sample.canConvert< QskGraphic >() )
|
||||||
{
|
{
|
||||||
const auto graphic = sample.value< QskGraphic >();
|
const auto graphic = sample.value< QskGraphic >();
|
||||||
|
|
@ -202,7 +202,7 @@ class QskMenuSkinlet::PrivateData
|
||||||
{
|
{
|
||||||
using Q = QskMenu;
|
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 textHeight = menu->effectiveFontHeight( Q::Text );
|
||||||
const auto padding = menu->paddingHint( Q::Segment );
|
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 );
|
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 r = sampleRect( menu, contentsRect, Q::Segment, index );
|
||||||
const auto graphicWidth = m_data->graphicWidth( menu );
|
const auto graphicWidth = m_data->graphicWidth( menu );
|
||||||
|
|
||||||
if ( subControl == QskMenu::Graphic )
|
if ( subControl == QskMenu::Icon )
|
||||||
{
|
{
|
||||||
auto graphicRect = r;
|
auto graphicRect = r;
|
||||||
graphicRect.setWidth( graphicWidth );
|
graphicRect.setWidth( graphicWidth );
|
||||||
const auto padding = menu->paddingHint( QskMenu::Graphic );
|
const auto padding = menu->paddingHint( QskMenu::Icon );
|
||||||
graphicRect = graphicRect.marginsRemoved( padding );
|
graphicRect = graphicRect.marginsRemoved( padding );
|
||||||
|
|
||||||
return graphicRect;
|
return graphicRect;
|
||||||
|
|
@ -378,7 +378,7 @@ int QskMenuSkinlet::sampleCount(
|
||||||
{
|
{
|
||||||
using Q = QskMenu;
|
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 );
|
const auto menu = static_cast< const QskMenu* >( skinnable );
|
||||||
return menu->count();
|
return menu->count();
|
||||||
|
|
@ -400,7 +400,7 @@ QskAspect::States QskMenuSkinlet::sampleStates(
|
||||||
|
|
||||||
auto states = Inherited::sampleStates( skinnable, subControl, index );
|
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 );
|
const auto menu = static_cast< const QskMenu* >( skinnable );
|
||||||
if ( menu->currentIndex() == index )
|
if ( menu->currentIndex() == index )
|
||||||
|
|
@ -417,7 +417,7 @@ QVariant QskMenuSkinlet::sampleAt( const QskSkinnable* skinnable,
|
||||||
|
|
||||||
const auto menu = static_cast< const QskMenu* >( skinnable );
|
const auto menu = static_cast< const QskMenu* >( skinnable );
|
||||||
|
|
||||||
if ( subControl == Q::Graphic )
|
if ( subControl == Q::Icon )
|
||||||
return qskSampleAt< QskGraphic >( menu, index );
|
return qskSampleAt< QskGraphic >( menu, index );
|
||||||
|
|
||||||
if ( subControl == Q::Text )
|
if ( subControl == Q::Text )
|
||||||
|
|
@ -436,8 +436,8 @@ QSGNode* QskMenuSkinlet::updateContentsNode(
|
||||||
QSGNode* QskMenuSkinlet::updateMenuNode(
|
QSGNode* QskMenuSkinlet::updateMenuNode(
|
||||||
const QskSkinnable* skinnable, QSGNode* contentsNode ) const
|
const QskSkinnable* skinnable, QSGNode* contentsNode ) const
|
||||||
{
|
{
|
||||||
enum { Panel, Segment, Cursor, Graphic, Text, Separator };
|
enum { Panel, Segment, Cursor, Icon, Text, Separator };
|
||||||
static QVector< quint8 > roles = { Panel, Separator, Segment, Cursor, Graphic, Text };
|
static QVector< quint8 > roles = { Panel, Separator, Segment, Cursor, Icon, Text };
|
||||||
|
|
||||||
if ( contentsNode == nullptr )
|
if ( contentsNode == nullptr )
|
||||||
contentsNode = new QSGNode();
|
contentsNode = new QSGNode();
|
||||||
|
|
@ -465,9 +465,9 @@ QSGNode* QskMenuSkinlet::updateMenuNode(
|
||||||
newNode = updateBoxNode( skinnable, oldNode, QskMenu::Cursor );
|
newNode = updateBoxNode( skinnable, oldNode, QskMenu::Cursor );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Graphic:
|
case Icon:
|
||||||
{
|
{
|
||||||
newNode = updateSeriesNode( skinnable, QskMenu::Graphic, oldNode );
|
newNode = updateSeriesNode( skinnable, QskMenu::Icon, oldNode );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Text:
|
case Text:
|
||||||
|
|
@ -502,7 +502,7 @@ QSGNode* QskMenuSkinlet::updateSampleNode( const QskSkinnable* skinnable,
|
||||||
return updateBoxNode( menu, node, rect, subControl );
|
return updateBoxNode( menu, node, rect, subControl );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( subControl == Q::Graphic )
|
if ( subControl == Q::Icon )
|
||||||
{
|
{
|
||||||
const auto graphic = qskValueAt< QskGraphic >( menu, index );
|
const auto graphic = qskValueAt< QskGraphic >( menu, index );
|
||||||
if ( graphic.isNull() )
|
if ( graphic.isNull() )
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
QSK_SUBCONTROL( QskPushButton, Panel )
|
QSK_SUBCONTROL( QskPushButton, Panel )
|
||||||
QSK_SUBCONTROL( QskPushButton, Splash )
|
QSK_SUBCONTROL( QskPushButton, Splash )
|
||||||
QSK_SUBCONTROL( QskPushButton, Text )
|
QSK_SUBCONTROL( QskPushButton, Text )
|
||||||
QSK_SUBCONTROL( QskPushButton, Graphic )
|
QSK_SUBCONTROL( QskPushButton, Icon )
|
||||||
|
|
||||||
class QskPushButton::PrivateData
|
class QskPushButton::PrivateData
|
||||||
{
|
{
|
||||||
|
|
@ -26,29 +26,29 @@ class QskPushButton::PrivateData
|
||||||
PrivateData( const QString& txt )
|
PrivateData( const QString& txt )
|
||||||
: text( txt )
|
: text( txt )
|
||||||
, isCheckable( false )
|
, isCheckable( false )
|
||||||
, isGraphicSourceDirty( false )
|
, isIconSourceDirty( false )
|
||||||
, emphasis( NoEmphasis )
|
, emphasis( NoEmphasis )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ensureGraphic( const QskPushButton* button )
|
void ensureIcon( const QskPushButton* button )
|
||||||
{
|
{
|
||||||
if ( isGraphicSourceDirty )
|
if ( isIconSourceDirty )
|
||||||
{
|
{
|
||||||
if ( !graphicSource.isEmpty() )
|
if ( !iconSource.isEmpty() )
|
||||||
graphic = button->loadGraphic( graphicSource );
|
icon = button->loadIcon( iconSource );
|
||||||
|
|
||||||
isGraphicSourceDirty = false;
|
isIconSourceDirty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
QUrl graphicSource;
|
QUrl iconSource;
|
||||||
QskGraphic graphic;
|
QskGraphic icon;
|
||||||
|
|
||||||
bool isCheckable : 1;
|
bool isCheckable : 1;
|
||||||
bool isGraphicSourceDirty : 1;
|
bool isIconSourceDirty : 1;
|
||||||
int emphasis : 4;
|
int emphasis : 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -153,13 +153,13 @@ QFont QskPushButton::font() const
|
||||||
return effectiveFont( Text );
|
return effectiveFont( Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskPushButton::resetGraphicStrutSize()
|
void QskPushButton::resetIconStrutSize()
|
||||||
{
|
{
|
||||||
if ( resetStrutSizeHint( Graphic ) )
|
if ( resetStrutSizeHint( Icon ) )
|
||||||
Q_EMIT graphicStrutSizeChanged();
|
Q_EMIT iconStrutSizeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskPushButton::setGraphicStrutSize( const QSizeF& size )
|
void QskPushButton::setIconStrutSize( const QSizeF& size )
|
||||||
{
|
{
|
||||||
auto newSize = size;
|
auto newSize = size;
|
||||||
if ( newSize.width() < 0.0 )
|
if ( newSize.width() < 0.0 )
|
||||||
|
|
@ -168,57 +168,57 @@ void QskPushButton::setGraphicStrutSize( const QSizeF& size )
|
||||||
if ( newSize.height() < 0.0 )
|
if ( newSize.height() < 0.0 )
|
||||||
newSize.setHeight( -1.0 );
|
newSize.setHeight( -1.0 );
|
||||||
|
|
||||||
if ( setStrutSizeHint( Graphic, newSize ) )
|
if ( setStrutSizeHint( Icon, newSize ) )
|
||||||
Q_EMIT graphicStrutSizeChanged();
|
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;
|
return;
|
||||||
|
|
||||||
m_data->graphicSource = url;
|
m_data->iconSource = url;
|
||||||
m_data->graphic.reset();
|
m_data->icon.reset();
|
||||||
|
|
||||||
m_data->isGraphicSourceDirty = true;
|
m_data->isIconSourceDirty = true;
|
||||||
|
|
||||||
resetImplicitSize();
|
resetImplicitSize();
|
||||||
polish();
|
polish();
|
||||||
update();
|
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->iconSource = QString();
|
||||||
m_data->isGraphicSourceDirty = false;
|
m_data->isIconSourceDirty = false;
|
||||||
|
|
||||||
Q_EMIT graphicSourceChanged();
|
Q_EMIT iconSourceChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT graphicChanged();
|
Q_EMIT iconChanged();
|
||||||
|
|
||||||
resetImplicitSize();
|
resetImplicitSize();
|
||||||
polish();
|
polish();
|
||||||
|
|
@ -226,20 +226,20 @@ void QskPushButton::setGraphic( const QskGraphic& graphic )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QskGraphic QskPushButton::graphic() const
|
QskGraphic QskPushButton::icon() const
|
||||||
{
|
{
|
||||||
m_data->ensureGraphic( this );
|
m_data->ensureIcon( this );
|
||||||
return m_data->graphic;
|
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()
|
void QskPushButton::updateResources()
|
||||||
{
|
{
|
||||||
m_data->ensureGraphic( this );
|
m_data->ensureIcon( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskAspect::Variation QskPushButton::effectiveVariation() const
|
QskAspect::Variation QskPushButton::effectiveVariation() const
|
||||||
|
|
@ -274,11 +274,11 @@ void QskPushButton::changeEvent( QEvent* event )
|
||||||
{
|
{
|
||||||
case QEvent::StyleChange:
|
case QEvent::StyleChange:
|
||||||
{
|
{
|
||||||
if ( !m_data->graphicSource.isEmpty() &&
|
if ( !m_data->iconSource.isEmpty() &&
|
||||||
qskSetup->skin()->hasGraphicProvider() )
|
qskSetup->skin()->hasGraphicProvider() )
|
||||||
{
|
{
|
||||||
// we might need to reload from a different skin
|
// we might need to reload from a different skin
|
||||||
m_data->isGraphicSourceDirty = true;
|
m_data->isIconSourceDirty = true;
|
||||||
}
|
}
|
||||||
break;
|
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 );
|
return Qsk::loadGraphic( url );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,15 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
||||||
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
||||||
WRITE setTextOptions RESET resetTextOptions NOTIFY textOptionsChanged )
|
WRITE setTextOptions RESET resetTextOptions NOTIFY textOptionsChanged )
|
||||||
|
|
||||||
Q_PROPERTY( QUrl graphicSource READ graphicSource
|
Q_PROPERTY( QUrl iconSource READ iconSource
|
||||||
WRITE setGraphicSource NOTIFY graphicSourceChanged FINAL )
|
WRITE setIconSource NOTIFY iconSourceChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( QskGraphic graphic READ graphic
|
Q_PROPERTY( QskGraphic icon READ icon
|
||||||
WRITE setGraphic NOTIFY graphicChanged FINAL )
|
WRITE setIcon NOTIFY iconChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( QSizeF graphicStrutSize READ graphicStrutSize
|
Q_PROPERTY( QSizeF iconStrutSize READ iconStrutSize
|
||||||
WRITE setGraphicStrutSize RESET resetGraphicStrutSize
|
WRITE setIconStrutSize RESET resetIconStrutSize
|
||||||
NOTIFY graphicStrutSizeChanged FINAL )
|
NOTIFY iconStrutSizeChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( bool checkable READ isCheckable
|
Q_PROPERTY( bool checkable READ isCheckable
|
||||||
WRITE setCheckable NOTIFY checkableChanged FINAL )
|
WRITE setCheckable NOTIFY checkableChanged FINAL )
|
||||||
|
|
@ -45,7 +45,7 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
||||||
using Inherited = QskAbstractButton;
|
using Inherited = QskAbstractButton;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Splash, Text, Graphic )
|
QSK_SUBCONTROLS( Panel, Splash, Text, Icon )
|
||||||
|
|
||||||
enum Emphasis
|
enum Emphasis
|
||||||
{
|
{
|
||||||
|
|
@ -78,13 +78,13 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
||||||
QskTextOptions textOptions() const;
|
QskTextOptions textOptions() const;
|
||||||
void resetTextOptions();
|
void resetTextOptions();
|
||||||
|
|
||||||
void setGraphicStrutSize( const QSizeF& );
|
void setIconStrutSize( const QSizeF& );
|
||||||
QSizeF graphicStrutSize() const;
|
QSizeF iconStrutSize() const;
|
||||||
void resetGraphicStrutSize();
|
void resetIconStrutSize();
|
||||||
|
|
||||||
QUrl graphicSource() const;
|
QUrl iconSource() const;
|
||||||
QskGraphic graphic() const;
|
QskGraphic icon() const;
|
||||||
bool hasGraphic() const;
|
bool hasIcon() const;
|
||||||
|
|
||||||
QFont font() const;
|
QFont font() const;
|
||||||
|
|
||||||
|
|
@ -93,9 +93,9 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setText( const QString& );
|
void setText( const QString& );
|
||||||
void setGraphicSource( const QUrl& );
|
void setIconSource( const QUrl& );
|
||||||
void setGraphicSource( const QString& );
|
void setIconSource( const QString& );
|
||||||
void setGraphic( const QskGraphic& );
|
void setIcon( const QskGraphic& );
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void checkableChanged( bool );
|
void checkableChanged( bool );
|
||||||
|
|
@ -105,16 +105,16 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
||||||
void textChanged();
|
void textChanged();
|
||||||
void textOptionsChanged();
|
void textOptionsChanged();
|
||||||
|
|
||||||
void graphicChanged();
|
void iconChanged();
|
||||||
void graphicSourceChanged();
|
void iconSourceChanged();
|
||||||
void graphicStrutSizeChanged();
|
void iconStrutSizeChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent( QEvent* ) override;
|
void changeEvent( QEvent* ) override;
|
||||||
void mousePressEvent( QMouseEvent* ) override;
|
void mousePressEvent( QMouseEvent* ) override;
|
||||||
|
|
||||||
void updateResources() override;
|
void updateResources() override;
|
||||||
virtual QskGraphic loadGraphic( const QUrl& ) const;
|
virtual QskGraphic loadIcon( const QUrl& ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class PrivateData;
|
class PrivateData;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ namespace
|
||||||
|
|
||||||
setGraphicTextElements( button,
|
setGraphicTextElements( button,
|
||||||
QskPushButton::Text, button->text(),
|
QskPushButton::Text, button->text(),
|
||||||
QskPushButton::Graphic, button->graphic().defaultSize() );
|
QskPushButton::Icon, button->icon().defaultSize() );
|
||||||
|
|
||||||
const auto alignment = button->alignmentHint(
|
const auto alignment = button->alignmentHint(
|
||||||
QskPushButton::Panel, Qt::AlignCenter );
|
QskPushButton::Panel, Qt::AlignCenter );
|
||||||
|
|
@ -50,7 +50,7 @@ namespace
|
||||||
QskPushButtonSkinlet::QskPushButtonSkinlet( QskSkin* skin )
|
QskPushButtonSkinlet::QskPushButtonSkinlet( QskSkin* skin )
|
||||||
: Inherited( skin )
|
: Inherited( skin )
|
||||||
{
|
{
|
||||||
setNodeRoles( { PanelRole, SplashRole, GraphicRole, TextRole } );
|
setNodeRoles( { PanelRole, SplashRole, IconRole, TextRole } );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskPushButtonSkinlet::~QskPushButtonSkinlet() = default;
|
QskPushButtonSkinlet::~QskPushButtonSkinlet() = default;
|
||||||
|
|
@ -68,7 +68,7 @@ QRectF QskPushButtonSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||||
if ( subControl == Q::Splash )
|
if ( subControl == Q::Splash )
|
||||||
return splashRect( button, contentsRect );
|
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 );
|
const auto r = button->subControlContentsRect( contentsRect, Q::Panel );
|
||||||
|
|
||||||
|
|
@ -99,8 +99,8 @@ QSGNode* QskPushButtonSkinlet::updateSubNode(
|
||||||
case TextRole:
|
case TextRole:
|
||||||
return updateTextNode( button, node );
|
return updateTextNode( button, node );
|
||||||
|
|
||||||
case GraphicRole:
|
case IconRole:
|
||||||
return updateGraphicNode( button, node, button->graphic(), Q::Graphic );
|
return updateGraphicNode( button, node, button->icon(), Q::Icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class QSK_EXPORT QskPushButtonSkinlet : public QskSkinlet
|
||||||
PanelRole,
|
PanelRole,
|
||||||
SplashRole,
|
SplashRole,
|
||||||
TextRole,
|
TextRole,
|
||||||
GraphicRole,
|
IconRole,
|
||||||
|
|
||||||
RoleCount
|
RoleCount
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ QSK_SUBCONTROL( QskSegmentedBar, Segment )
|
||||||
QSK_SUBCONTROL( QskSegmentedBar, Separator )
|
QSK_SUBCONTROL( QskSegmentedBar, Separator )
|
||||||
QSK_SUBCONTROL( QskSegmentedBar, Cursor )
|
QSK_SUBCONTROL( QskSegmentedBar, Cursor )
|
||||||
QSK_SUBCONTROL( QskSegmentedBar, Text )
|
QSK_SUBCONTROL( QskSegmentedBar, Text )
|
||||||
QSK_SUBCONTROL( QskSegmentedBar, Graphic )
|
QSK_SUBCONTROL( QskSegmentedBar, Icon )
|
||||||
|
|
||||||
QSK_SYSTEM_STATE( QskSegmentedBar, Selected, QskAspect::FirstSystemState << 1 )
|
QSK_SYSTEM_STATE( QskSegmentedBar, Selected, QskAspect::FirstSystemState << 1 )
|
||||||
QSK_SYSTEM_STATE( QskSegmentedBar, Minimum, QskAspect::FirstSystemState << 2 )
|
QSK_SYSTEM_STATE( QskSegmentedBar, Minimum, QskAspect::FirstSystemState << 2 )
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class QSK_EXPORT QskSegmentedBar : public QskControl
|
||||||
using Inherited = QskControl;
|
using Inherited = QskControl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Segment, Separator, Cursor, Text, Graphic )
|
QSK_SUBCONTROLS( Panel, Segment, Separator, Cursor, Text, Icon )
|
||||||
QSK_STATES( Selected, Minimum, Maximum )
|
QSK_STATES( Selected, Minimum, Maximum )
|
||||||
|
|
||||||
QskSegmentedBar( QQuickItem* parent = nullptr );
|
QskSegmentedBar( QQuickItem* parent = nullptr );
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QskGraphic graphicAt( const QskSegmentedBar* bar, const int index )
|
QskGraphic iconAt( const QskSegmentedBar* bar, const int index )
|
||||||
{
|
{
|
||||||
using Q = QskSegmentedBar;
|
using Q = QskSegmentedBar;
|
||||||
|
|
||||||
|
|
@ -48,9 +48,9 @@ namespace
|
||||||
{
|
{
|
||||||
// f.e Material 3 replaces the icon of the selected element by a checkmark
|
// f.e Material 3 replaces the icon of the selected element by a checkmark
|
||||||
|
|
||||||
const auto graphic = bar->symbolHint( Q::Graphic | Q::Selected );
|
const auto icon = bar->symbolHint( Q::Icon | Q::Selected );
|
||||||
if ( !graphic.isNull() )
|
if ( !icon.isNull() )
|
||||||
return graphic;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
return qskValueAt< QskGraphic >( bar, index );
|
return qskValueAt< QskGraphic >( bar, index );
|
||||||
|
|
@ -68,7 +68,7 @@ namespace
|
||||||
|
|
||||||
setGraphicTextElements( bar,
|
setGraphicTextElements( bar,
|
||||||
Q::Text, qskValueAt< QString >( bar, index ),
|
Q::Text, qskValueAt< QString >( bar, index ),
|
||||||
Q::Graphic, graphicAt( bar, index ).defaultSize() );
|
Q::Icon, iconAt( bar, index ).defaultSize() );
|
||||||
|
|
||||||
if( bar->orientation() == Qt::Horizontal )
|
if( bar->orientation() == Qt::Horizontal )
|
||||||
{
|
{
|
||||||
|
|
@ -83,7 +83,7 @@ QskSegmentedBarSkinlet::QskSegmentedBarSkinlet( QskSkin* skin )
|
||||||
: Inherited( skin )
|
: Inherited( skin )
|
||||||
{
|
{
|
||||||
setNodeRoles( { PanelRole, SegmentRole,
|
setNodeRoles( { PanelRole, SegmentRole,
|
||||||
SeparatorRole, CursorRole, TextRole, GraphicRole } );
|
SeparatorRole, CursorRole, TextRole, IconRole } );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSegmentedBarSkinlet::~QskSegmentedBarSkinlet() = default;
|
QskSegmentedBarSkinlet::~QskSegmentedBarSkinlet() = default;
|
||||||
|
|
@ -216,8 +216,8 @@ QSGNode* QskSegmentedBarSkinlet::updateSubNode(
|
||||||
case TextRole:
|
case TextRole:
|
||||||
return updateSeriesNode( skinnable, Q::Text, node );
|
return updateSeriesNode( skinnable, Q::Text, node );
|
||||||
|
|
||||||
case GraphicRole:
|
case IconRole:
|
||||||
return updateSeriesNode( skinnable, Q::Graphic, node );
|
return updateSeriesNode( skinnable, Q::Icon, node );
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -230,7 +230,7 @@ QSizeF QskSegmentedBarSkinlet::segmentSizeHint(
|
||||||
|
|
||||||
QSizeF sizeMax;
|
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++ )
|
for ( int i = 0; i < bar->count(); i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -242,7 +242,7 @@ QSizeF QskSegmentedBarSkinlet::segmentSizeHint(
|
||||||
|
|
||||||
layoutEngine.setGraphicTextElements( bar,
|
layoutEngine.setGraphicTextElements( bar,
|
||||||
Q::Text, qskValueAt< QString >( bar, i ),
|
Q::Text, qskValueAt< QString >( bar, i ),
|
||||||
Q::Graphic, graphic.defaultSize() );
|
Q::Icon, graphic.defaultSize() );
|
||||||
|
|
||||||
const auto size = layoutEngine.sizeHint( which, QSizeF() );
|
const auto size = layoutEngine.sizeHint( which, QSizeF() );
|
||||||
|
|
||||||
|
|
@ -318,7 +318,7 @@ QRectF QskSegmentedBarSkinlet::sampleRect( const QskSkinnable* skinnable,
|
||||||
return separatorRect( bar, contentsRect, index );
|
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 );
|
const auto rect = sampleRect( skinnable, contentsRect, Q::Segment, index );
|
||||||
|
|
||||||
|
|
@ -337,7 +337,7 @@ QskAspect::States QskSegmentedBarSkinlet::sampleStates(
|
||||||
|
|
||||||
auto states = Inherited::sampleStates( skinnable, subControl, index );
|
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 );
|
const auto bar = static_cast< const QskSegmentedBar* >( skinnable );
|
||||||
|
|
||||||
|
|
@ -384,14 +384,14 @@ QSGNode* QskSegmentedBarSkinlet::updateSampleNode( const QskSkinnable* skinnable
|
||||||
return nullptr;
|
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() )
|
if( !graphic.isEmpty() )
|
||||||
{
|
{
|
||||||
const auto filter = bar->effectiveGraphicFilter( subControl );
|
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 );
|
const auto graphicRect = rect.marginsRemoved( padding );
|
||||||
|
|
||||||
return QskSkinlet::updateGraphicNode(
|
return QskSkinlet::updateGraphicNode(
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class QSK_EXPORT QskSegmentedBarSkinlet : public QskSkinlet
|
||||||
CursorRole,
|
CursorRole,
|
||||||
|
|
||||||
TextRole,
|
TextRole,
|
||||||
GraphicRole,
|
IconRole,
|
||||||
|
|
||||||
RoleCount
|
RoleCount
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue