uncrustified
This commit is contained in:
parent
3a1a7c635c
commit
3983da2025
|
@ -13,9 +13,6 @@ QSK_SUBCONTROL( Box, Panel )
|
|||
Box::Box( const QString& title, QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Vertical, parent )
|
||||
{
|
||||
setAutoAddChildren( true );
|
||||
setAutoLayoutChildren( true );
|
||||
|
||||
setPanel( true );
|
||||
setSubcontrolProxy( QskBox::Panel, Box::Panel );
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ QSK_SUBCONTROL( BoxWithButtons, Panel )
|
|||
namespace
|
||||
{
|
||||
class UpAndDownBox : public QskLinearBox
|
||||
{
|
||||
{
|
||||
public:
|
||||
UpAndDownBox( QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Vertical, parent )
|
||||
|
|
|
@ -11,14 +11,11 @@
|
|||
#include <QEasingCurve>
|
||||
#include <QPainter>
|
||||
|
||||
namespace {
|
||||
namespace
|
||||
{
|
||||
class ArcNode : public QskPaintedNode
|
||||
{
|
||||
public:
|
||||
ArcNode() : QskPaintedNode()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
void setGradient( const QskGradient& gradient )
|
||||
{
|
||||
m_gradient = gradient;
|
||||
|
@ -59,7 +56,7 @@ namespace {
|
|||
m_position = position;
|
||||
}
|
||||
|
||||
virtual void paint( QPainter* painter, const QSizeF& size ) override
|
||||
void paint( QPainter* painter, const QSizeF& size ) override
|
||||
{
|
||||
int startAngle;
|
||||
int spanAngle;
|
||||
|
@ -81,7 +78,8 @@ namespace {
|
|||
|
||||
painter->setRenderHint( QPainter::Antialiasing, true );
|
||||
|
||||
const QRectF r( 0.5 * m_width, 0.5 * m_width, size.width() - m_width, size.height() - m_width );
|
||||
const QRectF r( 0.5 * m_width, 0.5 * m_width,
|
||||
size.width() - m_width, size.height() - m_width );
|
||||
|
||||
QGradientStops stops;
|
||||
|
||||
|
@ -109,7 +107,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
virtual uint hash() const override
|
||||
uint hash() const override
|
||||
{
|
||||
uint h = qHash( m_gradientType );
|
||||
h = qHash( m_width, h );
|
||||
|
@ -127,7 +125,7 @@ namespace {
|
|||
return h;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
QskGradient m_gradient;
|
||||
QGradient::Type m_gradientType;
|
||||
double m_width;
|
||||
|
@ -150,8 +148,7 @@ CircularProgressBarSkinlet::~CircularProgressBarSkinlet()
|
|||
}
|
||||
|
||||
QRectF CircularProgressBarSkinlet::subControlRect(
|
||||
const QskSkinnable* /*skinnable*/, const QRectF& contentsRect,
|
||||
QskAspect::Subcontrol /*subControl*/ ) const
|
||||
const QskSkinnable*, const QRectF& contentsRect, QskAspect::Subcontrol ) const
|
||||
{
|
||||
return contentsRect;
|
||||
}
|
||||
|
@ -173,7 +170,8 @@ QSGNode* CircularProgressBarSkinlet::updateSubNode(
|
|||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
}
|
||||
|
||||
QSGNode* CircularProgressBarSkinlet::updateBarNode( const CircularProgressBar* bar, quint8 nodeRole, QSGNode* node ) const
|
||||
QSGNode* CircularProgressBarSkinlet::updateBarNode(
|
||||
const CircularProgressBar* bar, quint8 nodeRole, QSGNode* node ) const
|
||||
{
|
||||
auto arcNode = static_cast< ArcNode* >( node );
|
||||
|
||||
|
|
|
@ -5,6 +5,15 @@
|
|||
|
||||
#include "Diagram.h"
|
||||
|
||||
QSK_SUBCONTROL( Diagram, Chart )
|
||||
QSK_SUBCONTROL( Diagram, Segments )
|
||||
QSK_SUBCONTROL( Diagram, ChartLine1 )
|
||||
QSK_SUBCONTROL( Diagram, ChartArea1 )
|
||||
QSK_SUBCONTROL( Diagram, ChartLine2 )
|
||||
QSK_SUBCONTROL( Diagram, ChartArea2 )
|
||||
QSK_SUBCONTROL( Diagram, ChartLine3 )
|
||||
QSK_SUBCONTROL( Diagram, ChartArea3 )
|
||||
|
||||
class Diagram::PrivateData
|
||||
{
|
||||
public:
|
||||
|
@ -15,15 +24,6 @@ class Diagram::PrivateData
|
|||
QVector< Types > types;
|
||||
};
|
||||
|
||||
QSK_SUBCONTROL( Diagram, Chart )
|
||||
QSK_SUBCONTROL( Diagram, Segments )
|
||||
QSK_SUBCONTROL( Diagram, ChartLine1 )
|
||||
QSK_SUBCONTROL( Diagram, ChartArea1 )
|
||||
QSK_SUBCONTROL( Diagram, ChartLine2 )
|
||||
QSK_SUBCONTROL( Diagram, ChartArea2 )
|
||||
QSK_SUBCONTROL( Diagram, ChartLine3 )
|
||||
QSK_SUBCONTROL( Diagram, ChartArea3 )
|
||||
|
||||
Diagram::Diagram( QQuickItem* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
|
@ -80,14 +80,4 @@ void Diagram::setChartPosition( Qsk::Position position )
|
|||
m_data->position = position;
|
||||
}
|
||||
|
||||
QSizeF Diagram::contentsSizeHint( Qt::SizeHint which, const QSizeF& ) const
|
||||
{
|
||||
if( which != Qt::PreferredSize )
|
||||
{
|
||||
return QSizeF();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
#include "moc_Diagram.cpp"
|
||||
|
|
|
@ -43,9 +43,6 @@ class Diagram : public QskControl
|
|||
Qsk::Position chartPosition() const;
|
||||
void setChartPosition( Qsk::Position );
|
||||
|
||||
protected:
|
||||
QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
||||
|
||||
private:
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
|
|
|
@ -143,10 +143,10 @@ LightDimmer::LightDimmer( const QskGradient& coldGradient,
|
|||
, m_warmGradient( warmGradient )
|
||||
{
|
||||
connect( this, &QQuickPaintedItem::widthChanged,
|
||||
this, &LightDimmer::updateGradient );
|
||||
this, &LightDimmer::updateGradient );
|
||||
|
||||
connect( this, &QQuickPaintedItem::heightChanged,
|
||||
this, &LightDimmer::updateGradient );
|
||||
this, &LightDimmer::updateGradient );
|
||||
}
|
||||
|
||||
void LightDimmer::updateGradient()
|
||||
|
|
|
@ -103,7 +103,7 @@ PieChartPainted::PieChartPainted( const QColor& color, const QskGradient& gradie
|
|||
[this]() { m_animator->start(); } );
|
||||
}
|
||||
|
||||
QSizeF PieChartPainted::contentsSizeHint( Qt::SizeHint /*sizeHint*/, const QSizeF& /*size*/ ) const
|
||||
QSizeF PieChartPainted::contentsSizeHint( Qt::SizeHint, const QSizeF& ) const
|
||||
{
|
||||
return {57, 57};
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class PieChartPainted : public QskControl
|
|||
int progress, int value, QQuickItem* parent = nullptr );
|
||||
|
||||
protected:
|
||||
virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
||||
QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
||||
void updateLayout() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -17,12 +17,14 @@ PieChartSkinlet::PieChartSkinlet( QskSkin* skin )
|
|||
setNodeRoles( { PanelRole, LabelsRole } );
|
||||
}
|
||||
|
||||
QRectF PieChartSkinlet::subControlRect( const QskSkinnable*, const QRectF& contentsRect, QskAspect::Subcontrol ) const
|
||||
QRectF PieChartSkinlet::subControlRect( const QskSkinnable*,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol ) const
|
||||
{
|
||||
return contentsRect;
|
||||
}
|
||||
|
||||
QSGNode* PieChartSkinlet::updateSubNode( const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
||||
QSGNode* PieChartSkinlet::updateSubNode( const QskSkinnable* skinnable,
|
||||
quint8 nodeRole, QSGNode* node ) const
|
||||
{
|
||||
const auto pieChart = static_cast< const PieChart* >( skinnable );
|
||||
|
||||
|
@ -71,7 +73,7 @@ QSGNode* PieChartSkinlet::updatePanelNode( const PieChart* pieChart, QSGNode* no
|
|||
return boxNode;
|
||||
}
|
||||
|
||||
QSGNode* PieChartSkinlet::updateLabelsNode( const PieChart* pieChart, QSGNode* /*node*/ ) const
|
||||
QSGNode* PieChartSkinlet::updateLabelsNode( const PieChart* pieChart, QSGNode* ) const
|
||||
{
|
||||
const int labelsCount = pieChart->labels().count();
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ QSK_SUBCONTROL( RoundedIcon, Icon )
|
|||
QSK_STATE( RoundedIcon, Bright, ( QskAspect::FirstUserState << 1 ) )
|
||||
QSK_STATE( RoundedIcon, Small, ( QskAspect::FirstUserState << 2 ) )
|
||||
|
||||
RoundedIcon::RoundedIcon( const QString& iconName, bool isBright, bool isSmall, QQuickItem* parent )
|
||||
RoundedIcon::RoundedIcon( const QString& iconName,
|
||||
bool isBright, bool isSmall, QQuickItem* parent )
|
||||
: QskBox( parent )
|
||||
{
|
||||
setPanel( true );
|
||||
|
|
|
@ -17,12 +17,12 @@ class RoundedIcon : public QskBox
|
|||
QSK_SUBCONTROLS( Panel, Icon )
|
||||
QSK_STATES( Bright, Small ) // to differentiate between orange and purple and small vs. big
|
||||
|
||||
RoundedIcon( const QString& iconName, bool isBright, bool isSmall,
|
||||
QQuickItem* parent = nullptr );
|
||||
RoundedIcon( const QString& iconName,
|
||||
bool isBright, bool isSmall, QQuickItem* parent = nullptr );
|
||||
|
||||
protected:
|
||||
void updateLayout() override;
|
||||
virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
||||
QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
||||
|
||||
private:
|
||||
QskGraphicLabel* m_graphicLabel = nullptr;
|
||||
|
|
|
@ -43,7 +43,9 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
TopBarItem::TopBarItem( int index, const QString& name, const QskGradient& gradient, int progress, int value, QQuickItem* parent )
|
||||
TopBarItem::TopBarItem(
|
||||
int index, const QString& name, const QskGradient& gradient,
|
||||
int progress, int value, QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Vertical, parent )
|
||||
, m_name( name )
|
||||
{
|
||||
|
@ -81,8 +83,6 @@ TopBar::TopBar( QQuickItem* parent )
|
|||
setPanel( true );
|
||||
setSubcontrolProxy( QskBox::Panel, Panel );
|
||||
|
||||
setAutoLayoutChildren( true );
|
||||
setAutoAddChildren( true );
|
||||
setSizePolicy( QskSizePolicy::Preferred, QskSizePolicy::Fixed );
|
||||
|
||||
const QStringList itemStrings = { "Living Room", "Bedroom", "Bathroom", "Kitchen" };
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace
|
|||
public:
|
||||
UsageDiagram( QQuickItem* parent = nullptr )
|
||||
: Diagram( parent )
|
||||
{
|
||||
{
|
||||
// These values are calculated with a boost::math::cubic_b_spline.
|
||||
// We just output the values here to get rid of the dependency:
|
||||
|
||||
|
@ -126,7 +126,7 @@ namespace
|
|||
|
||||
for( size_t i = 0; i < count; i++ )
|
||||
points += QPointF( i, values[i] );
|
||||
|
||||
|
||||
addDataPoints( points, Diagram::Area );
|
||||
}
|
||||
};
|
||||
|
@ -144,7 +144,7 @@ UsageDiagramLegend::UsageDiagramLegend( QQuickItem* parent )
|
|||
addItem( new LegendItem( UsageDiagramLegend::Electricity ) );
|
||||
addItem( new LegendItem( UsageDiagramLegend::Gas ) );
|
||||
}
|
||||
|
||||
|
||||
UsageDiagramBox::UsageDiagramBox( QQuickItem* parent )
|
||||
: Box( QString(), parent )
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ UsageDiagramBox::UsageDiagramBox( QQuickItem* parent )
|
|||
|
||||
const char* days[] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
|
||||
|
||||
for( size_t i = 0; i < sizeof( days ) / sizeof( days[0] ) ; i++ )
|
||||
for( size_t i = 0; i < sizeof( days ) / sizeof( days[0] ); i++ )
|
||||
{
|
||||
auto box = new QskBox( true );
|
||||
box->setSubcontrolProxy( QskBox::Panel, UsageDiagramBox::DaysBox );
|
||||
|
|
Loading…
Reference in New Issue