style some more

This commit is contained in:
Peter Hartmann 2021-03-31 18:02:34 +02:00
parent c74845e562
commit 621851cda7
6 changed files with 29 additions and 27 deletions

View File

@ -10,7 +10,10 @@ QSK_SUBCONTROL( BigRoundedIcon, Panel )
QSK_SUBCONTROL( BoxWithButtons, Panel )
BoxWithButtons::BoxWithButtons( const QString& title, const QskGradient& gradient, QQuickItem* parent )
QSK_SUBCONTROL( IndoorTemperature, Panel )
QSK_SUBCONTROL( Humidity, Panel )
BoxWithButtons::BoxWithButtons( const QString& title, bool isBright, QQuickItem* parent )
: Box( "", parent )
{
setPanel( true );
@ -21,7 +24,7 @@ BoxWithButtons::BoxWithButtons( const QString& title, const QskGradient& gradien
QString iconFile = title.toLower();
iconFile = iconFile.replace( ' ', '-' );
auto* icon = new BigRoundedIcon( iconFile, gradient, layout );
auto* icon = new BigRoundedIcon( iconFile, isBright, layout );
icon->setFixedSize( 68, 68 ); // ### fix properly
auto* titleAndValue = new QskLinearBox( Qt::Vertical, layout );

View File

@ -11,22 +11,9 @@ class BigRoundedIcon : public RoundedIcon
public:
QSK_SUBCONTROLS( Panel )
BigRoundedIcon( const QString& iconName, const QskGradient& gradient, QQuickItem* parent = nullptr )
: RoundedIcon( iconName, gradient, parent )
BigRoundedIcon( const QString& iconName, bool isBright, QQuickItem* parent = nullptr )
: RoundedIcon( iconName, isBright, parent )
{
setGradientHint( Panel, gradient );
setBoxShapeHint( Panel, 6 );
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskBox::Panel )
{
return Panel;
}
return subControl;
}
};
@ -35,10 +22,10 @@ class BoxWithButtons : public Box
public:
QSK_SUBCONTROLS( Panel )
BoxWithButtons( const QString& title, const QskGradient& gradient, QQuickItem* parent = nullptr );
BoxWithButtons( const QString& title, bool isBright, QQuickItem* parent = nullptr );
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final
QskAspect::Subcontrol subControl ) const override
{
if( subControl == QskBox::Panel )
{
@ -52,8 +39,10 @@ class BoxWithButtons : public Box
class IndoorTemperature : public BoxWithButtons
{
public:
QSK_SUBCONTROLS( Panel )
IndoorTemperature( QQuickItem* parent )
: BoxWithButtons( "Indoor Temperature", { QskGradient::Vertical, "#ff7d34", "#ff3122" }, parent )
: BoxWithButtons( "Indoor Temperature", true, parent )
{
}
};
@ -61,8 +50,10 @@ class IndoorTemperature : public BoxWithButtons
class Humidity: public BoxWithButtons
{
public:
QSK_SUBCONTROLS( Panel )
Humidity( QQuickItem* parent )
: BoxWithButtons( "Humidity", { QskGradient::Vertical, "#6776FF", "#6100FF" }, parent )
: BoxWithButtons( "Humidity", false, parent )
{
}
};

View File

@ -14,14 +14,14 @@ namespace
class Device : public QskLinearBox
{
public:
Device( const QString& name, const QskGradient& gradient, QQuickItem* parent )
Device( const QString& name, const QskGradient& gradient, QQuickItem* parent ) // ### remove gradient and style
: QskLinearBox( Qt::Vertical, parent )
, m_name( name )
{
setDefaultAlignment( Qt::AlignCenter );
setAutoAddChildren( false );
m_icon = new RoundedIcon( QString(), gradient, this );
m_icon = new RoundedIcon( QString(), this );
m_icon->setOpacity( 0.15 );
m_icon->setFixedWidth( 60 );
addItem( m_icon );

View File

@ -7,15 +7,20 @@
#include <QImage>
QSK_SUBCONTROL( RoundedIcon, Panel )
QSK_STATE( RoundedIcon, Bright, ( QskAspect::FirstUserState << 1 ) )
RoundedIcon::RoundedIcon( const QString& iconName, const QskGradient& gradient, QQuickItem* parent )
RoundedIcon::RoundedIcon( const QString& iconName, bool isBright, QQuickItem* parent )
: QskBox( parent )
, m_iconName( iconName )
, m_gradient( gradient )
{
setPanel( true );
setPolishOnResize( true );
if( isBright )
{
setSkinState( Bright );
}
setSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Constrained );
QString fileName = ":/images/" + iconName + ".png";

View File

@ -12,8 +12,9 @@ class RoundedIcon : public QskBox
public:
QSK_SUBCONTROLS( Panel )
QSK_STATES( Bright ) // just to differentiate between orange and purple
RoundedIcon( const QString& iconName, const QskGradient& gradient, QQuickItem* parent = nullptr );
RoundedIcon( const QString& iconName, bool isBright, QQuickItem* parent = nullptr );
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override
@ -32,7 +33,6 @@ class RoundedIcon : public QskBox
private:
QString m_iconName;
QskGradient m_gradient;
QskGraphicLabel* m_graphicLabel = nullptr;
};

View File

@ -101,6 +101,9 @@ void Skin::initHints( const Palette& palette )
// content in boxes (indoor temperature, humidity etc.):
ed.setPadding( BoxWithButtons::Panel, 8 );
ed.setBoxShape( RoundedIcon::Panel, 6 );
ed.setVGradient( RoundedIcon::Panel | RoundedIcon::Bright, "#ff7d34", "#ff3122" );
ed.setVGradient( RoundedIcon::Panel, "#6776FF", "#6100FF" );
// palette dependent skin hints:
ed.setGradient( MenuBar::Panel, palette.menuBar );