File indexing completed on 2024-05-12 05:38:57

0001 #ifndef PAINTEDSYMBOLITEM_P_H
0002 #define PAINTEDSYMBOLITEM_P_H
0003 
0004 #include "paintedsymbolitem.h"
0005 
0006 #include <array>
0007 #include <tuple>
0008 
0009 class PaintedSymbolItemPrivate
0010 {
0011     Q_DECLARE_PUBLIC(PaintedSymbolItem)
0012     Q_DISABLE_COPY(PaintedSymbolItemPrivate)
0013 public:
0014     PaintedSymbolItemPrivate(PaintedSymbolItem *qq)
0015         : q_ptr(qq)
0016     {
0017     }
0018     PaintedSymbolItem *const q_ptr;
0019 
0020     QColor color;
0021     qreal penWidth = 1.001; // 1 causes weird distortion
0022     PaintedSymbolItem::SymbolType symbolType = PaintedSymbolItem::None;
0023 
0024     QPen pen = QPen(color, penWidth, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin);
0025     QFontMetricsF fontMetrics = QFontMetricsF(QGuiApplication::font());
0026     qreal targetSymbolSize = 0.0;
0027     qreal remainder = 0.0;
0028 
0029     // Normalized points. The range is 0 to 1 and the coordinates are scaled to fit the size of the drawing area.
0030     // clang-format off
0031     QList<QList<QPointF>> shapePoints = {
0032         {QPointF(0.0, 0.5), QPointF(1.0/3.0, 5.0/6.0), QPointF(1.0, 1.0/6.0)}, // Checkmark
0033         {QPointF(1.0/1.5, 0.0), QPointF(0.25, 0.5), QPointF(1.0/1.5, 1.0)}, // LeftArrow
0034         {QPointF(1.0/3.0, 0.0), QPointF(0.75, 0.5), QPointF(1.0/3.0, 1.0)}, // RightArrow
0035         {QPointF(0.0, 1.0/1.5), QPointF(0.5, 0.25), QPointF(1.0, 1.0/1.5)}, // UpArrow
0036         {QPointF(0.0, 1.0/3.0), QPointF(0.5, 0.75), QPointF(1.0, 1.0/3.0)}, // DownArrow
0037     };
0038     // clang-format on
0039 };
0040 #endif