| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | // W A R N I N G |
| 5 | // ------------- |
| 6 | // |
| 7 | // This file is not part of the Qt Chart API. It exists purely as an |
| 8 | // implementation detail. This header file may change from version to |
| 9 | // version without notice, or even be removed. |
| 10 | // |
| 11 | // We mean it. |
| 12 | |
| 13 | #ifndef QLEGENDMARKERPRIVATE_H |
| 14 | #define QLEGENDMARKERPRIVATE_H |
| 15 | |
| 16 | #include <QtCharts/QChartGlobal> |
| 17 | #include <QGraphicsObject> |
| 18 | #include <QtGui/QBrush> |
| 19 | #include <QtGui/QPen> |
| 20 | #include <QtWidgets/QGraphicsLayoutItem> |
| 21 | #include <QtCharts/private/qchartglobal_p.h> |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | class QAbstractSeries; |
| 26 | class QLegend; |
| 27 | |
| 28 | class QLegendMarker; |
| 29 | class LegendMarkerItem; |
| 30 | |
| 31 | class Q_CHARTS_EXPORT QLegendMarkerPrivate : public QObject |
| 32 | { |
| 33 | Q_OBJECT |
| 34 | public: |
| 35 | explicit QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend); |
| 36 | virtual ~QLegendMarkerPrivate(); |
| 37 | |
| 38 | // Helper for now. (or declare LegendLayout as friend) |
| 39 | LegendMarkerItem* item() const { return m_item; } |
| 40 | |
| 41 | virtual QAbstractSeries* series() = 0; |
| 42 | virtual QObject* relatedObject() = 0; |
| 43 | |
| 44 | void invalidateLegend(); |
| 45 | void invalidateAllItems(); |
| 46 | |
| 47 | public Q_SLOTS: |
| 48 | virtual void updated() = 0; |
| 49 | void handleShapeChange(); |
| 50 | |
| 51 | protected: |
| 52 | LegendMarkerItem *m_item; |
| 53 | QLegend *m_legend; |
| 54 | bool m_customLabel; |
| 55 | bool m_customBrush; |
| 56 | bool m_customPen; |
| 57 | |
| 58 | private: |
| 59 | QLegendMarker *q_ptr; |
| 60 | |
| 61 | friend class QLegendPrivate; |
| 62 | friend class LegendMarkerItem; |
| 63 | Q_DECLARE_PUBLIC(QLegendMarker) |
| 64 | }; |
| 65 | |
| 66 | QT_END_NAMESPACE |
| 67 | |
| 68 | #endif // QLEGENDMARKERPRIVATE_H |
| 69 | |