Refactor diagram before replacing it

This commit is contained in:
Peter Hartmann 2021-04-16 09:41:16 +02:00
parent 5e9cf09695
commit 0c08aca07f
5 changed files with 15 additions and 15 deletions

View File

@ -2,7 +2,7 @@
#include "Box.h"
#include "BoxWithButtons.h"
#include "Diagram.h"
#include "UsageDiagram.h"
#include "LightIntensity.h"
#include "MyDevices.h"
#include "PieChart.h"
@ -104,7 +104,7 @@ MainContent::MainContent( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, par
auto* myDevices = new MyDevices( gridBox );
gridBox->addItem( myDevices, 0, 2, 2, 1 );
auto* diagram = new Diagram( gridBox );
auto* diagram = new UsageDiagram( gridBox );
gridBox->addItem( diagram, 2, 0, 0, 2 );
auto* lightIntensity = new LightIntensity( gridBox );

View File

@ -142,7 +142,7 @@ void Skin::initHints( const Palette& palette )
ed.setGradient( CaptionColorBox::Panel | CaptionItem::Electricity, {"#ff3122"} );
ed.setGradient( CaptionColorBox::Panel | CaptionItem::Gas, {"#ff7d34"} );
ed.setPadding( Diagram::Panel, 0 );
ed.setPadding( UsageDiagram::Panel, 0 );
ed.setFontRole( WeekdayLabel::Text, QskSkin::TinyFont );
ed.setPadding( WeekdayLabel::Panel, {0, 5, 0, 10} );
@ -163,7 +163,7 @@ void Skin::initHints( const Palette& palette )
ed.setGradient( MainContent::Panel, palette.mainContent );
ed.setGradient( Box::Panel, palette.box );
ed.setGradient( BoxWithButtons::Panel, palette.box );
ed.setGradient( Diagram::Panel, palette.box );
ed.setGradient( UsageDiagram::Panel, palette.box );
ed.setColor( LightDisplay::Panel, palette.lightDisplay );
ed.setColor( PieChartPainted::Panel, palette.pieChart );
ed.setGradient( RoundButton::Panel, palette.roundButton );

View File

@ -1,4 +1,4 @@
#include "Diagram.h"
#include "UsageDiagram.h"
#include <QskBoxBorderColors.h>
#include <QskBoxBorderMetrics.h>
@ -25,7 +25,7 @@ QSK_STATE( CaptionItem, Gas, ( QskAspect::FirstUserState << 3 ) )
QSK_SUBCONTROL( CaptionBox, Panel )
QSK_SUBCONTROL( Diagram, Panel )
QSK_SUBCONTROL( UsageDiagram, Panel )
CaptionItem::CaptionItem( QskAspect::State state, QQuickItem* parent )
: QskLinearBox( Qt::Horizontal, parent )
@ -134,7 +134,7 @@ namespace
static constexpr int segments = 7;
Diagram::Diagram( QQuickItem* parent )
UsageDiagram::UsageDiagram( QQuickItem* parent )
: Box( "", parent )
, m_weekdays( new QskGridBox( this ) )
, m_content( new DiagramContent( this ) )
@ -166,7 +166,7 @@ Diagram::Diagram( QQuickItem* parent )
addItem( m_content );
}
void Diagram::updateLayout()
void UsageDiagram::updateLayout()
{
auto* firstWeekday = static_cast<QskControl*>( m_weekdays->itemAt( 1, 0 ) );
qreal w = size().width();

View File

@ -1,5 +1,5 @@
#ifndef DIAGRAM_H
#define DIAGRAM_H
#ifndef USAGEDIAGRAM_H
#define USAGEDIAGRAM_H
#include "Box.h"
@ -120,14 +120,14 @@ class CaptionBox : public QskLinearBox
}
};
class Diagram : public Box
class UsageDiagram : public Box
{
Q_OBJECT
public:
QSK_SUBCONTROLS( Panel )
Diagram( QQuickItem* parent );
UsageDiagram( QQuickItem* parent );
void updateLayout() override;
QskAspect::Subcontrol effectiveSubcontrol(
@ -158,4 +158,4 @@ class DiagramContent : public QQuickPaintedItem
};
#endif // DIAGRAM_H
#endif // USAGEDIAGRAM_H

View File

@ -4,7 +4,7 @@ SOURCES += \
Box.cpp \
BoxWithButtons.cpp \
CircularProgressBar.cpp \
Diagram.cpp \
UsageDiagram.cpp \
LightIntensity.cpp \
MainContent.cpp \
MenuBar.cpp \
@ -24,7 +24,7 @@ HEADERS += \
Box.h \
BoxWithButtons.h \
CircularProgressBar.h \
Diagram.h \
UsageDiagram.h \
LightIntensity.h \
MainContent.h \
MainWindow.h \