@@ -1,111 +1,111 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef QLEGEND_H |
|
21 | #ifndef QLEGEND_H | |
22 | #define QLEGEND_H |
|
22 | #define QLEGEND_H | |
23 |
|
23 | |||
24 |
#include < |
|
24 | #include <qchartglobal.h> | |
25 | #include <QGraphicsWidget> |
|
25 | #include <QGraphicsWidget> | |
26 | #include <QPen> |
|
26 | #include <QPen> | |
27 | #include <QBrush> |
|
27 | #include <QBrush> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 | class Domain; |
|
31 | class Domain; | |
32 | class LegendMarker; |
|
32 | class LegendMarker; | |
33 | class QPieSlice; |
|
33 | class QPieSlice; | |
34 | class QXYSeries; |
|
34 | class QXYSeries; | |
35 | class QBarSet; |
|
35 | class QBarSet; | |
36 | class QAbstractBarSeries; |
|
36 | class QAbstractBarSeries; | |
37 | class QPieSeries; |
|
37 | class QPieSeries; | |
38 | class QAreaSeries; |
|
38 | class QAreaSeries; | |
39 | class LegendScrollButton; |
|
39 | class LegendScrollButton; | |
40 | class QChart; |
|
40 | class QChart; | |
41 | class QLegendPrivate; |
|
41 | class QLegendPrivate; | |
42 |
|
42 | |||
43 | class QTCOMMERCIALCHART_EXPORT QLegend : public QGraphicsWidget |
|
43 | class QTCOMMERCIALCHART_EXPORT QLegend : public QGraphicsWidget | |
44 | { |
|
44 | { | |
45 | Q_OBJECT |
|
45 | Q_OBJECT | |
46 | Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) |
|
46 | Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) | |
47 | Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY backgroundVisibleChanged) |
|
47 | Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY backgroundVisibleChanged) | |
48 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
|
48 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) | |
49 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) |
|
49 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) | |
50 | Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) |
|
50 | Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) | |
51 | Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) |
|
51 | Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) | |
52 |
|
52 | |||
53 | private: |
|
53 | private: | |
54 | explicit QLegend(QChart *chart); |
|
54 | explicit QLegend(QChart *chart); | |
55 |
|
55 | |||
56 | public: |
|
56 | public: | |
57 | ~QLegend(); |
|
57 | ~QLegend(); | |
58 |
|
58 | |||
59 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
59 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | |
60 |
|
60 | |||
61 | void setBrush(const QBrush &brush); |
|
61 | void setBrush(const QBrush &brush); | |
62 | QBrush brush() const; |
|
62 | QBrush brush() const; | |
63 | void setColor(QColor color); |
|
63 | void setColor(QColor color); | |
64 | QColor color(); |
|
64 | QColor color(); | |
65 |
|
65 | |||
66 | void setPen(const QPen &pen); |
|
66 | void setPen(const QPen &pen); | |
67 | QPen pen() const; |
|
67 | QPen pen() const; | |
68 | void setBorderColor(QColor color); |
|
68 | void setBorderColor(QColor color); | |
69 | QColor borderColor(); |
|
69 | QColor borderColor(); | |
70 |
|
70 | |||
71 | void setFont(const QFont &font); |
|
71 | void setFont(const QFont &font); | |
72 | QFont font() const; |
|
72 | QFont font() const; | |
73 | void setLabelBrush(const QBrush &brush); |
|
73 | void setLabelBrush(const QBrush &brush); | |
74 | QBrush labelBrush() const; |
|
74 | QBrush labelBrush() const; | |
75 |
|
75 | |||
76 | void setLabelColor(QColor color); |
|
76 | void setLabelColor(QColor color); | |
77 | QColor labelColor() const; |
|
77 | QColor labelColor() const; | |
78 |
|
78 | |||
79 | void setAlignment(Qt::Alignment alignment); |
|
79 | void setAlignment(Qt::Alignment alignment); | |
80 | Qt::Alignment alignment() const; |
|
80 | Qt::Alignment alignment() const; | |
81 |
|
81 | |||
82 | void detachFromChart(); |
|
82 | void detachFromChart(); | |
83 | void attachToChart(); |
|
83 | void attachToChart(); | |
84 | bool isAttachedToChart(); |
|
84 | bool isAttachedToChart(); | |
85 |
|
85 | |||
86 | void setBackgroundVisible(bool visible = true); |
|
86 | void setBackgroundVisible(bool visible = true); | |
87 | bool isBackgroundVisible() const; |
|
87 | bool isBackgroundVisible() const; | |
88 |
|
88 | |||
89 |
|
89 | |||
90 | protected: |
|
90 | protected: | |
91 | void hideEvent(QHideEvent *event); |
|
91 | void hideEvent(QHideEvent *event); | |
92 | void showEvent(QShowEvent *event); |
|
92 | void showEvent(QShowEvent *event); | |
93 |
|
93 | |||
94 | Q_SIGNALS: |
|
94 | Q_SIGNALS: | |
95 | void backgroundVisibleChanged(bool visible); |
|
95 | void backgroundVisibleChanged(bool visible); | |
96 | void colorChanged(QColor color); |
|
96 | void colorChanged(QColor color); | |
97 | void borderColorChanged(QColor color); |
|
97 | void borderColorChanged(QColor color); | |
98 | void fontChanged(QFont font); |
|
98 | void fontChanged(QFont font); | |
99 | void labelColorChanged(QColor color); |
|
99 | void labelColorChanged(QColor color); | |
100 |
|
100 | |||
101 | private: |
|
101 | private: | |
102 | QScopedPointer<QLegendPrivate> d_ptr; |
|
102 | QScopedPointer<QLegendPrivate> d_ptr; | |
103 | Q_DISABLE_COPY(QLegend) |
|
103 | Q_DISABLE_COPY(QLegend) | |
104 | friend class LegendScroller; |
|
104 | friend class LegendScroller; | |
105 | friend class LegendLayout; |
|
105 | friend class LegendLayout; | |
106 | friend class ChartLayout; |
|
106 | friend class ChartLayout; | |
107 | }; |
|
107 | }; | |
108 |
|
108 | |||
109 | QTCOMMERCIALCHART_END_NAMESPACE |
|
109 | QTCOMMERCIALCHART_END_NAMESPACE | |
110 |
|
110 | |||
111 | #endif // QLEGEND_H |
|
111 | #endif // QLEGEND_H |
General Comments 0
You need to be logged in to leave comments.
Login now