Refactor diagram before replacing it
This commit is contained in:
parent
5e9cf09695
commit
0c08aca07f
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "Box.h"
|
#include "Box.h"
|
||||||
#include "BoxWithButtons.h"
|
#include "BoxWithButtons.h"
|
||||||
#include "Diagram.h"
|
#include "UsageDiagram.h"
|
||||||
#include "LightIntensity.h"
|
#include "LightIntensity.h"
|
||||||
#include "MyDevices.h"
|
#include "MyDevices.h"
|
||||||
#include "PieChart.h"
|
#include "PieChart.h"
|
||||||
|
@ -104,7 +104,7 @@ MainContent::MainContent( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, par
|
||||||
auto* myDevices = new MyDevices( gridBox );
|
auto* myDevices = new MyDevices( gridBox );
|
||||||
gridBox->addItem( myDevices, 0, 2, 2, 1 );
|
gridBox->addItem( myDevices, 0, 2, 2, 1 );
|
||||||
|
|
||||||
auto* diagram = new Diagram( gridBox );
|
auto* diagram = new UsageDiagram( gridBox );
|
||||||
gridBox->addItem( diagram, 2, 0, 0, 2 );
|
gridBox->addItem( diagram, 2, 0, 0, 2 );
|
||||||
|
|
||||||
auto* lightIntensity = new LightIntensity( gridBox );
|
auto* lightIntensity = new LightIntensity( gridBox );
|
||||||
|
|
|
@ -142,7 +142,7 @@ void Skin::initHints( const Palette& palette )
|
||||||
ed.setGradient( CaptionColorBox::Panel | CaptionItem::Electricity, {"#ff3122"} );
|
ed.setGradient( CaptionColorBox::Panel | CaptionItem::Electricity, {"#ff3122"} );
|
||||||
ed.setGradient( CaptionColorBox::Panel | CaptionItem::Gas, {"#ff7d34"} );
|
ed.setGradient( CaptionColorBox::Panel | CaptionItem::Gas, {"#ff7d34"} );
|
||||||
|
|
||||||
ed.setPadding( Diagram::Panel, 0 );
|
ed.setPadding( UsageDiagram::Panel, 0 );
|
||||||
|
|
||||||
ed.setFontRole( WeekdayLabel::Text, QskSkin::TinyFont );
|
ed.setFontRole( WeekdayLabel::Text, QskSkin::TinyFont );
|
||||||
ed.setPadding( WeekdayLabel::Panel, {0, 5, 0, 10} );
|
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( MainContent::Panel, palette.mainContent );
|
||||||
ed.setGradient( Box::Panel, palette.box );
|
ed.setGradient( Box::Panel, palette.box );
|
||||||
ed.setGradient( BoxWithButtons::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( LightDisplay::Panel, palette.lightDisplay );
|
||||||
ed.setColor( PieChartPainted::Panel, palette.pieChart );
|
ed.setColor( PieChartPainted::Panel, palette.pieChart );
|
||||||
ed.setGradient( RoundButton::Panel, palette.roundButton );
|
ed.setGradient( RoundButton::Panel, palette.roundButton );
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "Diagram.h"
|
#include "UsageDiagram.h"
|
||||||
|
|
||||||
#include <QskBoxBorderColors.h>
|
#include <QskBoxBorderColors.h>
|
||||||
#include <QskBoxBorderMetrics.h>
|
#include <QskBoxBorderMetrics.h>
|
||||||
|
@ -25,7 +25,7 @@ QSK_STATE( CaptionItem, Gas, ( QskAspect::FirstUserState << 3 ) )
|
||||||
|
|
||||||
QSK_SUBCONTROL( CaptionBox, Panel )
|
QSK_SUBCONTROL( CaptionBox, Panel )
|
||||||
|
|
||||||
QSK_SUBCONTROL( Diagram, Panel )
|
QSK_SUBCONTROL( UsageDiagram, Panel )
|
||||||
|
|
||||||
CaptionItem::CaptionItem( QskAspect::State state, QQuickItem* parent )
|
CaptionItem::CaptionItem( QskAspect::State state, QQuickItem* parent )
|
||||||
: QskLinearBox( Qt::Horizontal, parent )
|
: QskLinearBox( Qt::Horizontal, parent )
|
||||||
|
@ -134,7 +134,7 @@ namespace
|
||||||
|
|
||||||
static constexpr int segments = 7;
|
static constexpr int segments = 7;
|
||||||
|
|
||||||
Diagram::Diagram( QQuickItem* parent )
|
UsageDiagram::UsageDiagram( QQuickItem* parent )
|
||||||
: Box( "", parent )
|
: Box( "", parent )
|
||||||
, m_weekdays( new QskGridBox( this ) )
|
, m_weekdays( new QskGridBox( this ) )
|
||||||
, m_content( new DiagramContent( this ) )
|
, m_content( new DiagramContent( this ) )
|
||||||
|
@ -166,7 +166,7 @@ Diagram::Diagram( QQuickItem* parent )
|
||||||
addItem( m_content );
|
addItem( m_content );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Diagram::updateLayout()
|
void UsageDiagram::updateLayout()
|
||||||
{
|
{
|
||||||
auto* firstWeekday = static_cast<QskControl*>( m_weekdays->itemAt( 1, 0 ) );
|
auto* firstWeekday = static_cast<QskControl*>( m_weekdays->itemAt( 1, 0 ) );
|
||||||
qreal w = size().width();
|
qreal w = size().width();
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef DIAGRAM_H
|
#ifndef USAGEDIAGRAM_H
|
||||||
#define DIAGRAM_H
|
#define USAGEDIAGRAM_H
|
||||||
|
|
||||||
#include "Box.h"
|
#include "Box.h"
|
||||||
|
|
||||||
|
@ -120,14 +120,14 @@ class CaptionBox : public QskLinearBox
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Diagram : public Box
|
class UsageDiagram : public Box
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel )
|
QSK_SUBCONTROLS( Panel )
|
||||||
|
|
||||||
Diagram( QQuickItem* parent );
|
UsageDiagram( QQuickItem* parent );
|
||||||
void updateLayout() override;
|
void updateLayout() override;
|
||||||
|
|
||||||
QskAspect::Subcontrol effectiveSubcontrol(
|
QskAspect::Subcontrol effectiveSubcontrol(
|
||||||
|
@ -158,4 +158,4 @@ class DiagramContent : public QQuickPaintedItem
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIAGRAM_H
|
#endif // USAGEDIAGRAM_H
|
|
@ -4,7 +4,7 @@ SOURCES += \
|
||||||
Box.cpp \
|
Box.cpp \
|
||||||
BoxWithButtons.cpp \
|
BoxWithButtons.cpp \
|
||||||
CircularProgressBar.cpp \
|
CircularProgressBar.cpp \
|
||||||
Diagram.cpp \
|
UsageDiagram.cpp \
|
||||||
LightIntensity.cpp \
|
LightIntensity.cpp \
|
||||||
MainContent.cpp \
|
MainContent.cpp \
|
||||||
MenuBar.cpp \
|
MenuBar.cpp \
|
||||||
|
@ -24,7 +24,7 @@ HEADERS += \
|
||||||
Box.h \
|
Box.h \
|
||||||
BoxWithButtons.h \
|
BoxWithButtons.h \
|
||||||
CircularProgressBar.h \
|
CircularProgressBar.h \
|
||||||
Diagram.h \
|
UsageDiagram.h \
|
||||||
LightIntensity.h \
|
LightIntensity.h \
|
||||||
MainContent.h \
|
MainContent.h \
|
||||||
MainWindow.h \
|
MainWindow.h \
|
||||||
|
|
Loading…
Reference in New Issue