uncrustified

This commit is contained in:
Uwe Rathmann 2021-08-24 14:38:03 +02:00
parent 3a1a7c635c
commit 3983da2025
13 changed files with 42 additions and 57 deletions

View File

@ -13,9 +13,6 @@ QSK_SUBCONTROL( Box, Panel )
Box::Box( const QString& title, QQuickItem* parent ) Box::Box( const QString& title, QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent ) : QskLinearBox( Qt::Vertical, parent )
{ {
setAutoAddChildren( true );
setAutoLayoutChildren( true );
setPanel( true ); setPanel( true );
setSubcontrolProxy( QskBox::Panel, Box::Panel ); setSubcontrolProxy( QskBox::Panel, Box::Panel );

View File

@ -18,7 +18,7 @@ QSK_SUBCONTROL( BoxWithButtons, Panel )
namespace namespace
{ {
class UpAndDownBox : public QskLinearBox class UpAndDownBox : public QskLinearBox
{ {
public: public:
UpAndDownBox( QQuickItem* parent ) UpAndDownBox( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent ) : QskLinearBox( Qt::Vertical, parent )

View File

@ -11,14 +11,11 @@
#include <QEasingCurve> #include <QEasingCurve>
#include <QPainter> #include <QPainter>
namespace { namespace
{
class ArcNode : public QskPaintedNode class ArcNode : public QskPaintedNode
{ {
public: public:
ArcNode() : QskPaintedNode()
{
}
void setGradient( const QskGradient& gradient ) void setGradient( const QskGradient& gradient )
{ {
m_gradient = gradient; m_gradient = gradient;
@ -59,7 +56,7 @@ namespace {
m_position = position; m_position = position;
} }
virtual void paint( QPainter* painter, const QSizeF& size ) override void paint( QPainter* painter, const QSizeF& size ) override
{ {
int startAngle; int startAngle;
int spanAngle; int spanAngle;
@ -81,7 +78,8 @@ namespace {
painter->setRenderHint( QPainter::Antialiasing, true ); 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; QGradientStops stops;
@ -109,7 +107,7 @@ namespace {
} }
} }
virtual uint hash() const override uint hash() const override
{ {
uint h = qHash( m_gradientType ); uint h = qHash( m_gradientType );
h = qHash( m_width, h ); h = qHash( m_width, h );
@ -127,7 +125,7 @@ namespace {
return h; return h;
} }
private: private:
QskGradient m_gradient; QskGradient m_gradient;
QGradient::Type m_gradientType; QGradient::Type m_gradientType;
double m_width; double m_width;
@ -150,8 +148,7 @@ CircularProgressBarSkinlet::~CircularProgressBarSkinlet()
} }
QRectF CircularProgressBarSkinlet::subControlRect( QRectF CircularProgressBarSkinlet::subControlRect(
const QskSkinnable* /*skinnable*/, const QRectF& contentsRect, const QskSkinnable*, const QRectF& contentsRect, QskAspect::Subcontrol ) const
QskAspect::Subcontrol /*subControl*/ ) const
{ {
return contentsRect; return contentsRect;
} }
@ -173,7 +170,8 @@ QSGNode* CircularProgressBarSkinlet::updateSubNode(
return Inherited::updateSubNode( skinnable, nodeRole, node ); 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 ); auto arcNode = static_cast< ArcNode* >( node );

View File

@ -5,6 +5,15 @@
#include "Diagram.h" #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 class Diagram::PrivateData
{ {
public: public:
@ -15,15 +24,6 @@ class Diagram::PrivateData
QVector< Types > types; 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 ) Diagram::Diagram( QQuickItem* parent )
: Inherited( parent ) : Inherited( parent )
, m_data( new PrivateData() ) , m_data( new PrivateData() )
@ -80,14 +80,4 @@ void Diagram::setChartPosition( Qsk::Position position )
m_data->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" #include "moc_Diagram.cpp"

View File

@ -43,9 +43,6 @@ class Diagram : public QskControl
Qsk::Position chartPosition() const; Qsk::Position chartPosition() const;
void setChartPosition( Qsk::Position ); void setChartPosition( Qsk::Position );
protected:
QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
private: private:
class PrivateData; class PrivateData;
std::unique_ptr< PrivateData > m_data; std::unique_ptr< PrivateData > m_data;

View File

@ -143,10 +143,10 @@ LightDimmer::LightDimmer( const QskGradient& coldGradient,
, m_warmGradient( warmGradient ) , m_warmGradient( warmGradient )
{ {
connect( this, &QQuickPaintedItem::widthChanged, connect( this, &QQuickPaintedItem::widthChanged,
this, &LightDimmer::updateGradient ); this, &LightDimmer::updateGradient );
connect( this, &QQuickPaintedItem::heightChanged, connect( this, &QQuickPaintedItem::heightChanged,
this, &LightDimmer::updateGradient ); this, &LightDimmer::updateGradient );
} }
void LightDimmer::updateGradient() void LightDimmer::updateGradient()

View File

@ -103,7 +103,7 @@ PieChartPainted::PieChartPainted( const QColor& color, const QskGradient& gradie
[this]() { m_animator->start(); } ); [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}; return {57, 57};
} }

View File

@ -20,7 +20,7 @@ class PieChartPainted : public QskControl
int progress, int value, QQuickItem* parent = nullptr ); int progress, int value, QQuickItem* parent = nullptr );
protected: protected:
virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override; QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
void updateLayout() override; void updateLayout() override;
private: private:

View File

@ -17,12 +17,14 @@ PieChartSkinlet::PieChartSkinlet( QskSkin* skin )
setNodeRoles( { PanelRole, LabelsRole } ); 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; 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 ); const auto pieChart = static_cast< const PieChart* >( skinnable );
@ -71,7 +73,7 @@ QSGNode* PieChartSkinlet::updatePanelNode( const PieChart* pieChart, QSGNode* no
return boxNode; 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(); const int labelsCount = pieChart->labels().count();

View File

@ -17,7 +17,8 @@ QSK_SUBCONTROL( RoundedIcon, Icon )
QSK_STATE( RoundedIcon, Bright, ( QskAspect::FirstUserState << 1 ) ) QSK_STATE( RoundedIcon, Bright, ( QskAspect::FirstUserState << 1 ) )
QSK_STATE( RoundedIcon, Small, ( QskAspect::FirstUserState << 2 ) ) 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 ) : QskBox( parent )
{ {
setPanel( true ); setPanel( true );

View File

@ -17,12 +17,12 @@ class RoundedIcon : public QskBox
QSK_SUBCONTROLS( Panel, Icon ) QSK_SUBCONTROLS( Panel, Icon )
QSK_STATES( Bright, Small ) // to differentiate between orange and purple and small vs. big QSK_STATES( Bright, Small ) // to differentiate between orange and purple and small vs. big
RoundedIcon( const QString& iconName, bool isBright, bool isSmall, RoundedIcon( const QString& iconName,
QQuickItem* parent = nullptr ); bool isBright, bool isSmall, QQuickItem* parent = nullptr );
protected: protected:
void updateLayout() override; void updateLayout() override;
virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override; QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
private: private:
QskGraphicLabel* m_graphicLabel = nullptr; QskGraphicLabel* m_graphicLabel = nullptr;

View File

@ -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 ) : QskLinearBox( Qt::Vertical, parent )
, m_name( name ) , m_name( name )
{ {
@ -81,8 +83,6 @@ TopBar::TopBar( QQuickItem* parent )
setPanel( true ); setPanel( true );
setSubcontrolProxy( QskBox::Panel, Panel ); setSubcontrolProxy( QskBox::Panel, Panel );
setAutoLayoutChildren( true );
setAutoAddChildren( true );
setSizePolicy( QskSizePolicy::Preferred, QskSizePolicy::Fixed ); setSizePolicy( QskSizePolicy::Preferred, QskSizePolicy::Fixed );
const QStringList itemStrings = { "Living Room", "Bedroom", "Bathroom", "Kitchen" }; const QStringList itemStrings = { "Living Room", "Bedroom", "Bathroom", "Kitchen" };

View File

@ -65,7 +65,7 @@ namespace
public: public:
UsageDiagram( QQuickItem* parent = nullptr ) UsageDiagram( QQuickItem* parent = nullptr )
: Diagram( parent ) : Diagram( parent )
{ {
// These values are calculated with a boost::math::cubic_b_spline. // These values are calculated with a boost::math::cubic_b_spline.
// We just output the values here to get rid of the dependency: // 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++ ) for( size_t i = 0; i < count; i++ )
points += QPointF( i, values[i] ); points += QPointF( i, values[i] );
addDataPoints( points, Diagram::Area ); addDataPoints( points, Diagram::Area );
} }
}; };
@ -144,7 +144,7 @@ UsageDiagramLegend::UsageDiagramLegend( QQuickItem* parent )
addItem( new LegendItem( UsageDiagramLegend::Electricity ) ); addItem( new LegendItem( UsageDiagramLegend::Electricity ) );
addItem( new LegendItem( UsageDiagramLegend::Gas ) ); addItem( new LegendItem( UsageDiagramLegend::Gas ) );
} }
UsageDiagramBox::UsageDiagramBox( QQuickItem* parent ) UsageDiagramBox::UsageDiagramBox( QQuickItem* parent )
: Box( QString(), parent ) : Box( QString(), parent )
{ {
@ -158,7 +158,7 @@ UsageDiagramBox::UsageDiagramBox( QQuickItem* parent )
const char* days[] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; 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 ); auto box = new QskBox( true );
box->setSubcontrolProxy( QskBox::Panel, UsageDiagramBox::DaysBox ); box->setSubcontrolProxy( QskBox::Panel, UsageDiagramBox::DaysBox );