mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-07 10:55:52 +00:00
move gihelper to own class from namespace
This action will allow to store data in the helper class. Also notification for high memory usage has been changed from 90 to 80.
This commit is contained in:
@ -19,28 +19,36 @@
|
||||
#define GRAPHICALITEMHELPER_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class QGraphicsScene;
|
||||
|
||||
namespace GraphicalItemHelper
|
||||
class GraphicalItemHelper : public QObject
|
||||
{
|
||||
// paint methods
|
||||
void paintCircle(const float &percent, const QColor &inactive,
|
||||
const QColor &active, const int &width, const int &height,
|
||||
QGraphicsScene *scene);
|
||||
void paintGraph(const QList<float> &value, const QColor &active,
|
||||
const int &width, const int &height, QGraphicsScene *scene);
|
||||
void paintHorizontal(const float &percent, const QColor &inactive,
|
||||
const QColor &active, const int &width, const int &height,
|
||||
QGraphicsScene *scene);
|
||||
void paintVertical(const float &percent, const QColor &inactive,
|
||||
const QColor &active, const int &width, const int &height,
|
||||
QGraphicsScene *scene);
|
||||
// additional conversion methods
|
||||
QString colorToString(const QColor &color);
|
||||
float getPercents(const float &value, const float &min, const float &max);
|
||||
QColor stringToColor(const QString &color);
|
||||
public:
|
||||
explicit GraphicalItemHelper(QObject *parent = nullptr,
|
||||
QGraphicsScene *scene = nullptr);
|
||||
virtual ~GraphicalItemHelper();
|
||||
// parameters
|
||||
void setParameters(const QColor active, const QColor inactive,
|
||||
const int width, const int height);
|
||||
// paint methods
|
||||
void paintCircle(const float &percent);
|
||||
void paintGraph(const QList<float> &value);
|
||||
void paintHorizontal(const float &percent);
|
||||
void paintVertical(const float &percent);
|
||||
// additional conversion methods
|
||||
QString colorToString(const QColor &color);
|
||||
float getPercents(const float &value, const float &min, const float &max);
|
||||
QColor stringToColor(const QString &color);
|
||||
|
||||
private:
|
||||
QGraphicsScene *m_scene = nullptr;
|
||||
QColor m_activeColor;
|
||||
QColor m_inactiveColor;
|
||||
int m_width;
|
||||
int m_height;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user