PieChartPainted renamed to EnergyMeter. Name was misleading as it is
more of a decorated arc progressbar than a pie or a doughnut chart.
This commit is contained in:
parent
70664a2f67
commit
4aeea2d6f8
@ -3,23 +3,18 @@
|
||||
* This file may be used under the terms of the 3-clause BSD License
|
||||
*****************************************************************************/
|
||||
|
||||
#include "PieChartPainted.h"
|
||||
#include "EnergyMeter.h"
|
||||
#include "CircularProgressBar.h"
|
||||
|
||||
#include <QskAnimator.h>
|
||||
#include <QskBox.h>
|
||||
#include <QskRgbValue.h>
|
||||
#include <QskSetup.h>
|
||||
#include <QskSkin.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskFunctions.h>
|
||||
#include <QskSkin.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
class ProgressLabel : public QskTextLabel
|
||||
class ValueLabel : public QskTextLabel
|
||||
{
|
||||
public:
|
||||
ProgressLabel( QQuickItem* parent )
|
||||
ValueLabel( QQuickItem* parent )
|
||||
: QskTextLabel( parent )
|
||||
{
|
||||
initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||
@ -34,22 +29,22 @@ namespace
|
||||
};
|
||||
}
|
||||
|
||||
PieChartPainted::PieChartPainted( const QColor& textColor, const QskGradient& gradient,
|
||||
int progress, QQuickItem* parent )
|
||||
EnergyMeter::EnergyMeter( const QColor& textColor,
|
||||
const QskGradient& gradient, int value, QQuickItem* parent )
|
||||
: QskControl( parent )
|
||||
{
|
||||
setAutoLayoutChildren( true );
|
||||
|
||||
auto progressBar = new CircularProgressBar( this );
|
||||
progressBar->setGradientHint( CircularProgressBar::Bar, gradient );
|
||||
progressBar->setValue( progress );
|
||||
auto valueBar = new CircularProgressBar( this );
|
||||
valueBar->setGradientHint( CircularProgressBar::Bar, gradient );
|
||||
valueBar->setValue( value );
|
||||
|
||||
auto progressLabel = new ProgressLabel( this );
|
||||
progressLabel->setTextColor( textColor );
|
||||
progressLabel->setValue( progress );
|
||||
auto valueLabel = new ValueLabel( this );
|
||||
valueLabel->setTextColor( textColor );
|
||||
valueLabel->setValue( value );
|
||||
}
|
||||
|
||||
QSizeF PieChartPainted::contentsSizeHint(
|
||||
QSizeF EnergyMeter::contentsSizeHint(
|
||||
Qt::SizeHint which, const QSizeF& constraint ) const
|
||||
{
|
||||
if ( which != Qt::PreferredSize )
|
@ -7,10 +7,10 @@
|
||||
|
||||
#include <QskControl.h>
|
||||
|
||||
class PieChartPainted : public QskControl
|
||||
class EnergyMeter : public QskControl
|
||||
{
|
||||
public:
|
||||
PieChartPainted( const QColor&, const QskGradient&,
|
||||
EnergyMeter( const QColor&, const QskGradient&,
|
||||
int progress, QQuickItem* parent = nullptr );
|
||||
|
||||
protected:
|
@ -4,7 +4,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "TopBar.h"
|
||||
#include "PieChartPainted.h"
|
||||
#include "EnergyMeter.h"
|
||||
|
||||
#include <QskSkin.h>
|
||||
#include <QskTextLabel.h>
|
||||
@ -62,7 +62,7 @@ TopBarItem::TopBarItem(
|
||||
const auto subcontrol = subcontrolForIndex( index );
|
||||
const auto textColor = color( subcontrol | QskAspect::TextColor );
|
||||
|
||||
auto pieChart = new PieChartPainted(
|
||||
auto pieChart = new EnergyMeter(
|
||||
textColor, gradient, progress, pieChartAndDisplay );
|
||||
pieChart->setSizePolicy( Qt::Horizontal, QskSizePolicy::Constrained );
|
||||
|
||||
|
@ -11,6 +11,7 @@ SOURCES += \
|
||||
DashboardPage.cpp \
|
||||
Diagram.cpp \
|
||||
DiagramSkinlet.cpp \
|
||||
EnergyMeter.cpp \
|
||||
GraphicProvider.cpp \
|
||||
GridBox.cpp \
|
||||
LightDisplaySkinlet.cpp \
|
||||
@ -18,7 +19,6 @@ SOURCES += \
|
||||
MainItem.cpp \
|
||||
MenuBar.cpp \
|
||||
MyDevices.cpp \
|
||||
PieChartPainted.cpp \
|
||||
RoomsPage.cpp \
|
||||
RoundedIcon.cpp \
|
||||
Skin.cpp \
|
||||
@ -41,6 +41,7 @@ HEADERS += \
|
||||
CircularProgressBarSkinlet.h \
|
||||
Diagram.h \
|
||||
DiagramSkinlet.h \
|
||||
EnergyMeter.h \
|
||||
GraphicProvider.h \
|
||||
GridBox.h \
|
||||
LightDisplaySkinlet.h \
|
||||
@ -50,7 +51,6 @@ HEADERS += \
|
||||
MainWindow.h \
|
||||
MenuBar.h \
|
||||
MyDevices.h \
|
||||
PieChartPainted.h \
|
||||
RoomsPage.h \
|
||||
RoundedIcon.h \
|
||||
Skin.h \
|
||||
|
Loading…
x
Reference in New Issue
Block a user