2022-09-23 02:34:18 +02:00
|
|
|
#ifndef STYLE_H
|
|
|
|
#define STYLE_H
|
|
|
|
|
|
|
|
#include <QPen>
|
|
|
|
#include <QBrush>
|
|
|
|
#include <QPixmap>
|
|
|
|
|
|
|
|
class PointStyle {
|
|
|
|
public:
|
|
|
|
PointStyle() : _size(-1) {}
|
|
|
|
PointStyle(const QPixmap &icon, const QColor &color = QColor(), int size = -1)
|
|
|
|
: _icon(icon), _color(color), _size(size) {}
|
2022-09-23 21:36:02 +02:00
|
|
|
PointStyle(const QColor &color, int size = -1)
|
|
|
|
: _color(color), _size(size) {}
|
2022-09-23 02:34:18 +02:00
|
|
|
|
|
|
|
const QColor &color() const {return _color;}
|
|
|
|
const QPixmap &icon() const {return _icon;}
|
|
|
|
int size() const {return _size;}
|
|
|
|
|
|
|
|
private:
|
|
|
|
QPixmap _icon;
|
|
|
|
QColor _color;
|
|
|
|
int _size;
|
|
|
|
};
|
|
|
|
|
|
|
|
class PolygonStyle {
|
|
|
|
public:
|
2022-09-23 21:36:02 +02:00
|
|
|
PolygonStyle() : _width(-1) {}
|
|
|
|
PolygonStyle(const QColor &fill, const QColor &stroke = QColor(),
|
|
|
|
qreal width = -1) : _fill(fill), _stroke(stroke), _width(width) {}
|
2022-09-23 02:34:18 +02:00
|
|
|
|
2022-09-23 21:36:02 +02:00
|
|
|
const QColor &fill() const {return _fill;}
|
|
|
|
const QColor &stroke() const {return _stroke;}
|
|
|
|
qreal width() const {return _width;}
|
2022-09-23 02:34:18 +02:00
|
|
|
|
|
|
|
bool isValid() const
|
2022-09-23 21:36:02 +02:00
|
|
|
{return _fill.isValid() || _stroke.isValid();}
|
2022-09-23 02:34:18 +02:00
|
|
|
|
|
|
|
private:
|
2022-09-23 21:36:02 +02:00
|
|
|
QColor _fill;
|
|
|
|
QColor _stroke;
|
|
|
|
qreal _width;
|
2022-09-23 02:34:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class LineStyle {
|
|
|
|
public:
|
2022-10-07 21:54:39 +02:00
|
|
|
LineStyle() : _width(-1), _style(Qt::NoPen) {}
|
|
|
|
LineStyle(const QColor &color, qreal width = -1,
|
|
|
|
Qt::PenStyle style = Qt::NoPen)
|
|
|
|
: _color(color), _width(width), _style(style) {}
|
2022-09-23 02:34:18 +02:00
|
|
|
|
|
|
|
const QColor &color() const {return _color;}
|
2022-09-23 21:36:02 +02:00
|
|
|
qreal width() const {return _width;}
|
2022-10-07 21:54:39 +02:00
|
|
|
Qt::PenStyle style() const {return _style;}
|
2022-09-23 02:34:18 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
QColor _color;
|
2022-09-23 21:36:02 +02:00
|
|
|
qreal _width;
|
2022-10-07 21:54:39 +02:00
|
|
|
Qt::PenStyle _style;
|
2022-09-23 02:34:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // STYLE_H
|