add night time skin
This commit is contained in:
parent
e360c16be3
commit
2a3913ef06
|
@ -8,6 +8,8 @@
|
||||||
#include <QskBoxShapeMetrics.h>
|
#include <QskBoxShapeMetrics.h>
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
|
|
||||||
|
QSK_SUBCONTROL( Box, Panel )
|
||||||
|
|
||||||
ShadowBox::ShadowBox( QQuickItem* parent )
|
ShadowBox::ShadowBox( QQuickItem* parent )
|
||||||
: QskControl( parent )
|
: QskControl( parent )
|
||||||
// , m_control( control )
|
// , m_control( control )
|
||||||
|
@ -73,3 +75,13 @@ Box::Box( const QString& title, QQuickItem* parent )
|
||||||
m_label->setVisible( false );
|
m_label->setVisible( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QskAspect::Subcontrol Box::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const
|
||||||
|
{
|
||||||
|
if( subControl == QskBox::Panel )
|
||||||
|
{
|
||||||
|
return Box::Panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return subControl;
|
||||||
|
}
|
||||||
|
|
|
@ -23,9 +23,15 @@ class ShadowBox : public QskControl
|
||||||
|
|
||||||
class Box : public QskLinearBox
|
class Box : public QskLinearBox
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
QSK_SUBCONTROLS( Panel )
|
||||||
|
|
||||||
Box( const QString& title, QQuickItem* parent );
|
Box( const QString& title, QQuickItem* parent );
|
||||||
|
|
||||||
|
QskAspect::Subcontrol effectiveSubcontrol(
|
||||||
|
QskAspect::Subcontrol subControl ) const override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_title;
|
QString m_title;
|
||||||
QskTextLabel* m_label;
|
QskTextLabel* m_label;
|
||||||
|
|
|
@ -23,7 +23,7 @@ void CircularProgressBar::paint(QPainter *painter)
|
||||||
gradient.setStops( {stop1, stop2, stop3} );
|
gradient.setStops( {stop1, stop2, stop3} );
|
||||||
|
|
||||||
painter->setBrush( gradient );
|
painter->setBrush( gradient );
|
||||||
painter->setPen(Qt::white);
|
painter->setPen( m_backgroundColor );
|
||||||
painter->drawEllipse( outerRect );
|
painter->drawEllipse( outerRect );
|
||||||
|
|
||||||
int startAngle = 1440;
|
int startAngle = 1440;
|
||||||
|
@ -32,8 +32,8 @@ void CircularProgressBar::paint(QPainter *painter)
|
||||||
painter->setBrush( m_gradient );
|
painter->setBrush( m_gradient );
|
||||||
painter->drawPie( outerRect, startAngle, endAngle );
|
painter->drawPie( outerRect, startAngle, endAngle );
|
||||||
|
|
||||||
painter->setBrush(Qt::white);
|
painter->setBrush( m_backgroundColor );
|
||||||
painter->setPen(Qt::white);
|
painter->setPen( m_backgroundColor );
|
||||||
QRectF innerRect( width() / 2, width() / 2, size.width() - width(), size.height() - width() );
|
QRectF innerRect( width() / 2, width() / 2, size.width() - width(), size.height() - width() );
|
||||||
painter->drawEllipse( innerRect );
|
painter->drawEllipse( innerRect );
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,16 +11,26 @@ public:
|
||||||
|
|
||||||
virtual void paint( QPainter* painter ) override;
|
virtual void paint( QPainter* painter ) override;
|
||||||
|
|
||||||
double width() const {
|
double width() const
|
||||||
|
{
|
||||||
return m_width;
|
return m_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWidth(double width) {
|
void setWidth( double width )
|
||||||
|
{
|
||||||
m_width = width;
|
m_width = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setBackgroundColor( const QColor& color )
|
||||||
|
{
|
||||||
|
m_backgroundColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGradient m_gradient;
|
QGradient m_gradient;
|
||||||
|
QColor m_backgroundColor;
|
||||||
double m_width = 20;
|
double m_width = 20;
|
||||||
int m_progress;
|
int m_progress;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
#include "DaytimeSkin.h"
|
#include "DaytimeSkin.h"
|
||||||
|
|
||||||
|
#include "Box.h"
|
||||||
|
#include "LightIntensity.h"
|
||||||
|
#include "MainContent.h"
|
||||||
#include "MenuBar.h"
|
#include "MenuBar.h"
|
||||||
#include "QskShadowedRectangle.h"
|
#include "QskShadowedRectangle.h"
|
||||||
#include "QskShadowedRectangleSkinlet.h"
|
#include "QskShadowedRectangleSkinlet.h"
|
||||||
#include "PieChart.h"
|
#include "PieChartPainted.h"
|
||||||
#include "PieChartSkinlet.h"
|
|
||||||
|
|
||||||
#include <QskBoxBorderMetrics.h>
|
#include <QskBoxBorderMetrics.h>
|
||||||
#include <QskBoxBorderColors.h>
|
#include <QskBoxBorderColors.h>
|
||||||
|
@ -32,7 +34,6 @@ namespace
|
||||||
DaytimeSkin::DaytimeSkin( QObject* parent ) : QskSkin( parent )
|
DaytimeSkin::DaytimeSkin( QObject* parent ) : QskSkin( parent )
|
||||||
{
|
{
|
||||||
declareSkinlet< QskShadowedRectangle, QskShadowedRectangleSkinlet >();
|
declareSkinlet< QskShadowedRectangle, QskShadowedRectangleSkinlet >();
|
||||||
declareSkinlet< PieChart, PieChartSkinlet >();
|
|
||||||
initHints();
|
initHints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +51,13 @@ void DaytimeSkin::initHints()
|
||||||
|
|
||||||
setFont( DaytimeSkin::TitleFont, qskFont( 10, true ) );
|
setFont( DaytimeSkin::TitleFont, qskFont( 10, true ) );
|
||||||
|
|
||||||
|
|
||||||
|
setGradient( MainContent::Panel, {"#fbfbfb"} );
|
||||||
|
setGradient( Box::Panel, {"#ffffff"} );
|
||||||
|
setColor( LightDisplay::Panel, "#ffffff" );
|
||||||
|
setColor( PieChartPainted::Panel, "#ffffff" );
|
||||||
|
|
||||||
QColor color( Qt::white );
|
QColor color( Qt::white );
|
||||||
color.setAlphaF( 0.09 );
|
color.setAlphaF( 0.09 );
|
||||||
setGradient( MenuItem::Panel | QskControl::Hovered, color );
|
setGradient( MenuItem::Panel | QskControl::Hovered, color );
|
||||||
|
|
||||||
setBoxBorderMetrics( PieChart::Panel, 2 );
|
|
||||||
setGradient( PieChart::Panel, Qt::blue );
|
|
||||||
setBoxBorderColors( PieChart::Panel, Qt::green );
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@ class DaytimeSkin : public QskSkin
|
||||||
public:
|
public:
|
||||||
DaytimeSkin( QObject* parent = nullptr );
|
DaytimeSkin( QObject* parent = nullptr );
|
||||||
|
|
||||||
enum SkinFontRole {
|
enum SkinFontRole
|
||||||
|
{
|
||||||
TitleFont = QskSkin::HugeFont + 1,
|
TitleFont = QskSkin::HugeFont + 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initHints();
|
void initHints();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DAYTIMESKIN_H
|
#endif // DAYTIMESKIN_H
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
Humidity::Humidity( QQuickItem* parent )
|
Humidity::Humidity( QQuickItem* parent )
|
||||||
: Box( "", parent )
|
: Box( "", parent )
|
||||||
{
|
{
|
||||||
|
setPanel( true );
|
||||||
setMarginsHint( Panel | QskAspect::Padding, 8 );
|
setMarginsHint( Panel | QskAspect::Padding, 8 );
|
||||||
setSizePolicy( Qt::Vertical, QskSizePolicy::Maximum );
|
setSizePolicy( Qt::Vertical, QskSizePolicy::Maximum );
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
IndoorTemperature::IndoorTemperature( QQuickItem* parent )
|
IndoorTemperature::IndoorTemperature( QQuickItem* parent )
|
||||||
: Box( "", parent )
|
: Box( "", parent )
|
||||||
{
|
{
|
||||||
|
setPanel( true );
|
||||||
setMarginsHint( Panel | QskAspect::Padding, 8 );
|
setMarginsHint( Panel | QskAspect::Padding, 8 );
|
||||||
setSizePolicy( Qt::Vertical, QskSizePolicy::Maximum );
|
setSizePolicy( Qt::Vertical, QskSizePolicy::Maximum );
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
#include "LightIntensity.h"
|
#include "LightIntensity.h"
|
||||||
#include "DaytimeSkin.h"
|
#include "DaytimeSkin.h"
|
||||||
|
|
||||||
|
#include <QskSetup.h>
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QRadialGradient>
|
#include <QRadialGradient>
|
||||||
|
|
||||||
|
QSK_SUBCONTROL( LightDisplay, Panel )
|
||||||
|
|
||||||
LightDimmer::LightDimmer( QQuickItem* parent )
|
LightDimmer::LightDimmer( QQuickItem* parent )
|
||||||
: QQuickPaintedItem( parent )
|
: QQuickPaintedItem( parent )
|
||||||
{
|
{
|
||||||
|
@ -28,7 +31,8 @@ void LightDimmer::paint( QPainter* painter )
|
||||||
gradient.setStops( {stop1, stop2, stop3} );
|
gradient.setStops( {stop1, stop2, stop3} );
|
||||||
|
|
||||||
painter->setBrush( gradient );
|
painter->setBrush( gradient );
|
||||||
painter->setPen( Qt::white );
|
|
||||||
|
painter->setPen( m_backgroundColor );
|
||||||
painter->drawEllipse( outerRect );
|
painter->drawEllipse( outerRect );
|
||||||
|
|
||||||
int startAngle = 16 * 180;
|
int startAngle = 16 * 180;
|
||||||
|
@ -48,12 +52,12 @@ void LightDimmer::paint( QPainter* painter )
|
||||||
painter->setBrush( redGradient );
|
painter->setBrush( redGradient );
|
||||||
painter->drawPie( outerRect, 16 * 90, endAngle );
|
painter->drawPie( outerRect, 16 * 90, endAngle );
|
||||||
|
|
||||||
painter->setBrush( Qt::white );
|
painter->setBrush( m_backgroundColor );
|
||||||
painter->setPen( Qt::white );
|
painter->setPen( m_backgroundColor );
|
||||||
QRectF innerRect( thickness() / 2, thickness() / 2 + offset, size.width() - thickness(), size.height() - thickness() );
|
QRectF innerRect( thickness() / 2, thickness() / 2 + offset, size.width() - thickness(), size.height() - thickness() );
|
||||||
painter->drawEllipse( innerRect );
|
painter->drawEllipse( innerRect );
|
||||||
|
|
||||||
painter->setBrush( Qt::white );
|
painter->setBrush( m_backgroundColor );
|
||||||
painter->setPen( "#c4c4c4" );
|
painter->setPen( "#c4c4c4" );
|
||||||
QRectF knobRect( ( contentsSize().width() - knobDiameter ) / 2, 1, knobDiameter, knobDiameter );
|
QRectF knobRect( ( contentsSize().width() - knobDiameter ) / 2, 1, knobDiameter, knobDiameter );
|
||||||
painter->drawEllipse( knobRect );
|
painter->drawEllipse( knobRect );
|
||||||
|
@ -75,6 +79,25 @@ LightDisplay::LightDisplay( QQuickItem* parent )
|
||||||
m_rightLabel->setZ( 1 );
|
m_rightLabel->setZ( 1 );
|
||||||
|
|
||||||
setAutoLayoutChildren( true );
|
setAutoLayoutChildren( true );
|
||||||
|
|
||||||
|
const QColor c = color( Panel );
|
||||||
|
m_dimmer->setBackgroundColor( c );
|
||||||
|
|
||||||
|
connect( qskSetup, &QskSetup::skinChanged, [this]()
|
||||||
|
{
|
||||||
|
const QColor c = color( Panel );
|
||||||
|
m_dimmer->setBackgroundColor( c );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
QskAspect::Subcontrol LightDisplay::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const
|
||||||
|
{
|
||||||
|
if( subControl == QskBox::Panel )
|
||||||
|
{
|
||||||
|
return LightDisplay::Panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return subControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightDisplay::updateLayout()
|
void LightDisplay::updateLayout()
|
||||||
|
|
|
@ -24,8 +24,14 @@ class LightDimmer: public QQuickPaintedItem
|
||||||
m_thickness = thickness;
|
m_thickness = thickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setBackgroundColor( const QColor& color )
|
||||||
|
{
|
||||||
|
m_backgroundColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_thickness = 17.57;
|
double m_thickness = 17.57;
|
||||||
|
QColor m_backgroundColor;
|
||||||
|
|
||||||
virtual void paint( QPainter* painter ) override;
|
virtual void paint( QPainter* painter ) override;
|
||||||
};
|
};
|
||||||
|
@ -35,8 +41,13 @@ class LightDisplay : public QskControl
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
QSK_SUBCONTROLS( Panel )
|
||||||
|
|
||||||
LightDisplay( QQuickItem* parent );
|
LightDisplay( QQuickItem* parent );
|
||||||
|
|
||||||
|
QskAspect::Subcontrol effectiveSubcontrol(
|
||||||
|
QskAspect::Subcontrol subControl ) const override final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateLayout() override;
|
void updateLayout() override;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
QSK_SUBCONTROL( MainContent, Panel )
|
||||||
|
|
||||||
ShadowPositioner::ShadowPositioner( QQuickItem* parent ) : QskControl( parent )
|
ShadowPositioner::ShadowPositioner( QQuickItem* parent ) : QskControl( parent )
|
||||||
{
|
{
|
||||||
setAutoLayoutChildren( true );
|
setAutoLayoutChildren( true );
|
||||||
|
@ -67,7 +69,7 @@ MainContent::MainContent( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, par
|
||||||
setSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding );
|
setSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding );
|
||||||
setDefaultAlignment( Qt::AlignTop );
|
setDefaultAlignment( Qt::AlignTop );
|
||||||
setSpacing( 24 );
|
setSpacing( 24 );
|
||||||
setBackgroundColor( "#FBFBFB" );
|
setPanel( true );
|
||||||
|
|
||||||
auto* topBar = new TopBar( this );
|
auto* topBar = new TopBar( this );
|
||||||
addItem( topBar );
|
addItem( topBar );
|
||||||
|
@ -103,6 +105,16 @@ MainContent::MainContent( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, par
|
||||||
m_shadowPositioner->setGridBox( gridBox );
|
m_shadowPositioner->setGridBox( gridBox );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QskAspect::Subcontrol MainContent::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const
|
||||||
|
{
|
||||||
|
if( subControl == QskBox::Panel )
|
||||||
|
{
|
||||||
|
return MainContent::Panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return subControl;
|
||||||
|
}
|
||||||
|
|
||||||
void MainContent::geometryChanged( const QRectF& newGeometry, const QRectF& oldGeometry )
|
void MainContent::geometryChanged( const QRectF& newGeometry, const QRectF& oldGeometry )
|
||||||
{
|
{
|
||||||
QskLinearBox::geometryChanged( newGeometry, oldGeometry );
|
QskLinearBox::geometryChanged( newGeometry, oldGeometry );
|
||||||
|
|
|
@ -26,8 +26,13 @@ class MainContent : public QskLinearBox
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
QSK_SUBCONTROLS( Panel )
|
||||||
|
|
||||||
MainContent( QQuickItem* parent );
|
MainContent( QQuickItem* parent );
|
||||||
|
|
||||||
|
QskAspect::Subcontrol effectiveSubcontrol(
|
||||||
|
QskAspect::Subcontrol subControl ) const override final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void geometryChanged( const QRectF&, const QRectF& ) override;
|
void geometryChanged( const QRectF&, const QRectF& ) override;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
#include "NighttimeSkin.h"
|
||||||
|
|
||||||
|
#include "Box.h"
|
||||||
|
#include "LightIntensity.h"
|
||||||
|
#include "MainContent.h"
|
||||||
|
#include "MenuBar.h"
|
||||||
|
#include "QskShadowedRectangle.h"
|
||||||
|
#include "QskShadowedRectangleSkinlet.h"
|
||||||
|
#include "PieChartPainted.h"
|
||||||
|
|
||||||
|
#include <QskBoxBorderMetrics.h>
|
||||||
|
#include <QskBoxBorderColors.h>
|
||||||
|
#include <QskFunctions.h>
|
||||||
|
|
||||||
|
#include <QFontDatabase>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
static inline QFont qskFont( qreal pointSize, bool semiBold = false )
|
||||||
|
{
|
||||||
|
QFont font( "Proxima Nova" );
|
||||||
|
|
||||||
|
if( semiBold )
|
||||||
|
{
|
||||||
|
font.setWeight( QFont::Bold );
|
||||||
|
}
|
||||||
|
|
||||||
|
font.setPointSizeF( pointSize /*/ qskDpiScaled( 1.0 )*/ );
|
||||||
|
return font;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NighttimeSkin::NighttimeSkin( QObject* parent ) : QskSkin( parent )
|
||||||
|
{
|
||||||
|
declareSkinlet< QskShadowedRectangle, QskShadowedRectangleSkinlet >();
|
||||||
|
initHints();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NighttimeSkin::initHints()
|
||||||
|
{
|
||||||
|
QFontDatabase db;
|
||||||
|
db.addApplicationFont( ":/fonts/ProximaNova-Regular.otf" ); // ### use fontconfig
|
||||||
|
|
||||||
|
setFont( QskSkin::DefaultFont, qskFont( 12 ) );
|
||||||
|
setFont( QskSkin::TinyFont, qskFont( 9 ) );
|
||||||
|
setFont( QskSkin::SmallFont, qskFont( 10 ) );
|
||||||
|
setFont( QskSkin::MediumFont, qskFont( 13 ) );
|
||||||
|
setFont( QskSkin::LargeFont, qskFont( 20 ) );
|
||||||
|
setFont( QskSkin::HugeFont, qskFont( 27, true ) );
|
||||||
|
|
||||||
|
setFont( NighttimeSkin::TitleFont, qskFont( 10, true ) );
|
||||||
|
|
||||||
|
|
||||||
|
setGradient( MainContent::Panel, {"#040404"} );
|
||||||
|
setGradient( Box::Panel, {"#000000"} );
|
||||||
|
setColor( LightDisplay::Panel, "#000000" );
|
||||||
|
setColor( PieChartPainted::Panel, "#000000" );
|
||||||
|
|
||||||
|
QColor color( Qt::white );
|
||||||
|
color.setAlphaF( 0.09 );
|
||||||
|
setGradient( MenuItem::Panel | QskControl::Hovered, Qt::yellow ); // ### nicer color
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef NIGHTTIMESKIN_H
|
||||||
|
#define NIGHTTIMESKIN_H
|
||||||
|
|
||||||
|
#include <QskSkin.h>
|
||||||
|
|
||||||
|
class NighttimeSkin : public QskSkin
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NighttimeSkin( QObject* parent = nullptr );
|
||||||
|
|
||||||
|
enum SkinFontRole
|
||||||
|
{
|
||||||
|
TitleFont = QskSkin::HugeFont + 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initHints();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NIGHTTIMESKIN_H
|
|
@ -1,11 +1,15 @@
|
||||||
#include "PieChartPainted.h"
|
#include "PieChartPainted.h"
|
||||||
|
|
||||||
|
#include <QskBox.h>
|
||||||
|
#include <QskSetup.h>
|
||||||
#include <QskSkin.h>
|
#include <QskSkin.h>
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
|
|
||||||
#include <QFontMetricsF>
|
#include <QFontMetricsF>
|
||||||
#include <QQuickPaintedItem>
|
#include <QQuickPaintedItem>
|
||||||
|
|
||||||
|
QSK_SUBCONTROL( PieChartPainted, Panel )
|
||||||
|
|
||||||
PieChartPainted::PieChartPainted( const QColor& color, const QGradient& gradient, int progress, int value, QQuickItem* parent )
|
PieChartPainted::PieChartPainted( const QColor& color, const QGradient& gradient, int progress, int value, QQuickItem* parent )
|
||||||
: QskControl( parent )
|
: QskControl( parent )
|
||||||
, m_color( color )
|
, m_color( color )
|
||||||
|
@ -21,6 +25,25 @@ PieChartPainted::PieChartPainted(const QColor& color, const QGradient& gradient,
|
||||||
m_progressLabel->setText( progressText );
|
m_progressLabel->setText( progressText );
|
||||||
m_progressLabel->setFontRole( QskSkin::SmallFont );
|
m_progressLabel->setFontRole( QskSkin::SmallFont );
|
||||||
m_progressLabel->setTextColor( color );
|
m_progressLabel->setTextColor( color );
|
||||||
|
|
||||||
|
const QColor c = this->color( Panel );
|
||||||
|
m_progressBar->setBackgroundColor( c );
|
||||||
|
|
||||||
|
connect( qskSetup, &QskSetup::skinChanged, [this]()
|
||||||
|
{
|
||||||
|
const QColor c = this->color( Panel );
|
||||||
|
m_progressBar->setBackgroundColor( c );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
QskAspect::Subcontrol PieChartPainted::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const
|
||||||
|
{
|
||||||
|
if( subControl == QskBox::Panel )
|
||||||
|
{
|
||||||
|
return PieChartPainted::Panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return subControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF PieChartPainted::contentsSizeHint( Qt::SizeHint /*sizeHint*/, const QSizeF& /*size*/ ) const
|
QSizeF PieChartPainted::contentsSizeHint( Qt::SizeHint /*sizeHint*/, const QSizeF& /*size*/ ) const
|
||||||
|
|
|
@ -11,8 +11,13 @@ class QQuickPaintedItem;
|
||||||
class PieChartPainted : public QskControl
|
class PieChartPainted : public QskControl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
QSK_SUBCONTROLS( Panel )
|
||||||
|
|
||||||
PieChartPainted( const QColor& color, const QGradient& gradient, int progress, int value, QQuickItem* parent = nullptr );
|
PieChartPainted( const QColor& color, const QGradient& gradient, int progress, int value, QQuickItem* parent = nullptr );
|
||||||
|
|
||||||
|
QskAspect::Subcontrol effectiveSubcontrol(
|
||||||
|
QskAspect::Subcontrol subControl ) const override final;
|
||||||
|
|
||||||
virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
||||||
void updateLayout() override;
|
void updateLayout() override;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
Usage::Usage( QQuickItem* parent )
|
Usage::Usage( QQuickItem* parent )
|
||||||
: Box( "Usage", parent )
|
: Box( "Usage", parent )
|
||||||
{
|
{
|
||||||
setBackgroundColor( Qt::transparent );
|
|
||||||
auto* content = new QskLinearBox( Qt::Vertical, this );
|
auto* content = new QskLinearBox( Qt::Vertical, this );
|
||||||
|
|
||||||
auto* today = new QskLinearBox( Qt::Horizontal, content );
|
auto* today = new QskLinearBox( Qt::Horizontal, content );
|
||||||
|
|
|
@ -11,6 +11,7 @@ SOURCES += \
|
||||||
MainContent.cpp \
|
MainContent.cpp \
|
||||||
MenuBar.cpp \
|
MenuBar.cpp \
|
||||||
MyDevices.cpp \
|
MyDevices.cpp \
|
||||||
|
NighttimeSkin.cpp \
|
||||||
PieChart.cpp \
|
PieChart.cpp \
|
||||||
PieChartPainted.cpp \
|
PieChartPainted.cpp \
|
||||||
PieChartSkinlet.cpp \
|
PieChartSkinlet.cpp \
|
||||||
|
@ -34,6 +35,7 @@ HEADERS += \
|
||||||
MainWindow.h \
|
MainWindow.h \
|
||||||
MenuBar.h \
|
MenuBar.h \
|
||||||
MyDevices.h \
|
MyDevices.h \
|
||||||
|
NighttimeSkin.h \
|
||||||
PieChart.h \
|
PieChart.h \
|
||||||
PieChartPainted.h \
|
PieChartPainted.h \
|
||||||
PieChartSkinlet.h \
|
PieChartSkinlet.h \
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
#include "DaytimeSkin.h"
|
#include "DaytimeSkin.h"
|
||||||
|
#include "NighttimeSkin.h"
|
||||||
|
|
||||||
#include <SkinnyFont.h>
|
#include <SkinnyFont.h>
|
||||||
#include <SkinnyShortcut.h>
|
#include <SkinnyShortcut.h>
|
||||||
|
@ -16,7 +17,8 @@
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
class SkinFactory : public QskSkinFactory
|
class SkinFactory : public QskSkinFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -28,8 +30,9 @@ namespace {
|
||||||
|
|
||||||
QStringList skinNames() const override
|
QStringList skinNames() const override
|
||||||
{
|
{
|
||||||
return { "DaytimeSkin" };
|
return { "DaytimeSkin", "NighttimeSkin" };
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* createSkin( const QString& skinName ) override
|
QskSkin* createSkin( const QString& skinName ) override
|
||||||
{
|
{
|
||||||
if( skinName == "DaytimeSkin" )
|
if( skinName == "DaytimeSkin" )
|
||||||
|
@ -37,6 +40,11 @@ namespace {
|
||||||
return new DaytimeSkin;
|
return new DaytimeSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( skinName == "NighttimeSkin" )
|
||||||
|
{
|
||||||
|
return new NighttimeSkin;
|
||||||
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -51,6 +59,9 @@ int main( int argc, char* argv[] )
|
||||||
SkinFactory skinFactory;
|
SkinFactory skinFactory;
|
||||||
|
|
||||||
qskSkinManager->setPluginPaths( QStringList() ); // no plugins
|
qskSkinManager->setPluginPaths( QStringList() ); // no plugins
|
||||||
|
|
||||||
|
qskSkinManager->unregisterFactory( "materialfactory" );
|
||||||
|
qskSkinManager->unregisterFactory( "squiekfactory" );
|
||||||
qskSkinManager->registerFactory(
|
qskSkinManager->registerFactory(
|
||||||
QStringLiteral( "SampleSkinFactory" ), &skinFactory );
|
QStringLiteral( "SampleSkinFactory" ), &skinFactory );
|
||||||
|
|
||||||
|
@ -58,12 +69,12 @@ int main( int argc, char* argv[] )
|
||||||
// false, skinFactory, SLOT(toggleScheme()) );
|
// false, skinFactory, SLOT(toggleScheme()) );
|
||||||
|
|
||||||
// QskShortcutMap::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_S ),
|
// QskShortcutMap::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_S ),
|
||||||
// false, skinFactory, SLOT(rotateSkin()) );
|
// true, &skinFactory, SLOT( rotateSkin() ) );
|
||||||
|
|
||||||
qskSetup->setSkin( "DaytimeSkin" );
|
qskSetup->setSkin( "DaytimeSkin" );
|
||||||
|
|
||||||
// With CTRL-B you can rotate a couple of visual debug modes
|
// With CTRL-B you can rotate a couple of visual debug modes
|
||||||
SkinnyShortcut::enable( SkinnyShortcut::DebugBackground |
|
SkinnyShortcut::enable( SkinnyShortcut::RotateSkin | SkinnyShortcut::DebugBackground |
|
||||||
SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit );
|
SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit );
|
||||||
|
|
||||||
MainWindow window;
|
MainWindow window;
|
||||||
|
|
Loading…
Reference in New Issue