Improve performance with image generation

To avoid pen creation on each update class properties is used.
This commit is contained in:
2016-03-24 15:53:07 +03:00
parent 88f0ebfe96
commit 7e42c8cb49
3 changed files with 38 additions and 54 deletions

View File

@ -19,8 +19,8 @@
#define GRAPHICALITEMHELPER_H
#include <QColor>
#include <QPixmap>
#include <QObject>
#include <QPen>
class QGraphicsScene;
@ -40,7 +40,6 @@ public:
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);
@ -48,10 +47,8 @@ private:
void storeValue(const float &value);
QGraphicsScene *m_scene = nullptr;
int m_count = 100;
QColor m_activeColor = QColor(0, 0, 0, 130);
QColor m_inactiveColor = QColor(255, 255, 255, 130);
QPixmap m_activeImage;
QPixmap m_inactiveImage;
QPen m_activePen;
QPen m_inactivePen;
int m_width = 100;
int m_height = 100;
// list of values which will be used to store data for graph type only