##// END OF EJS Templates
optional series parameter to markers function. code style fixes
sauimone -
r2193:7e0a20ef8117
parent child
Show More
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -24,29 +24,14
24 #include "qabstractseries_p.h"
24 #include "qabstractseries_p.h"
25 #include "qchart_p.h"
25 #include "qchart_p.h"
26 #include "legendlayout_p.h"
26 #include "legendlayout_p.h"
27 #include "qxyseries.h"
28 #include "qlineseries.h"
29 #include "qareaseries.h"
30 #include "qscatterseries.h"
31 #include "qsplineseries.h"
32 #include "qabstractbarseries.h"
33 #include "qstackedbarseries.h"
34 #include "qpercentbarseries.h"
35 #include "qbarset.h"
36 #include "qpieseries.h"
37 #include "qpieseries_p.h"
38 #include "qpieslice.h"
39 #include "chartpresenter_p.h"
27 #include "chartpresenter_p.h"
40 #include "chartlayout_p.h"
28 #include "chartlayout_p.h"
41 #include <QPainter>
42 #include <QPen>
43 #include <QTimer>
44 #include <QGraphicsSceneEvent>
45 #include <QGraphicsItemGroup>
46
47 #include "qlegendmarker.h"
29 #include "qlegendmarker.h"
48 #include "qlegendmarker_p.h"
30 #include "qlegendmarker_p.h"
49 #include "legendmarkeritem_p.h"
31 #include "legendmarkeritem_p.h"
32 #include <QPainter>
33 #include <QPen>
34 #include <QGraphicsItemGroup>
50
35
51 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
52
37
@@ -396,9 +381,9 bool QLegend::isBackgroundVisible() const
396 return d_ptr->m_backgroundVisible;
381 return d_ptr->m_backgroundVisible;
397 }
382 }
398
383
399 QList<QLegendMarker*> QLegend::markers() const
384 QList<QLegendMarker*> QLegend::markers(QAbstractSeries *series) const
400 {
385 {
401 return d_ptr->markers();
386 return d_ptr->markers(series);
402 }
387 }
403
388
404 void QLegend::addSeries(QAbstractSeries* series)
389 void QLegend::addSeries(QAbstractSeries *series)
@@ -472,6 +457,23 int QLegendPrivate::roundness(qreal size)
472 return 100 * m_diameter / int(size);
457 return 100 * m_diameter / int(size);
473 }
458 }
474
459
460 QList<QLegendMarker*> QLegendPrivate::markers(QAbstractSeries *series)
461 {
462 // Return all markers
463 if (!series) {
464 return m_markers;
465 }
466
467 // Create filtered list
468 QList<QLegendMarker *> markers;
469 foreach (QLegendMarker *marker, m_markers) {
470 if (marker->series() == series) {
471 markers.append(marker);
472 }
473 }
474 return markers;
475 }
476
475 void QLegendPrivate::addSeries(QAbstractSeries* series)
477 void QLegendPrivate::addSeries(QAbstractSeries *series)
476 {
478 {
477 // Only allow one instance of series
479 // Only allow one instance of series
@@ -80,7 +80,7 public:
80 bool isBackgroundVisible() const;
80 bool isBackgroundVisible() const;
81
81
82 // New stuff:
82 // New stuff:
83 QList <QLegendMarker*> markers() const;
83 QList <QLegendMarker*> markers(QAbstractSeries *series = 0) const;
84 void addSeries(QAbstractSeries* series);
84 void addSeries(QAbstractSeries *series);
85 void removeSeries(QAbstractSeries* series);
85 void removeSeries(QAbstractSeries *series);
86
86
@@ -55,8 +55,7 public:
55
55
56 QGraphicsItemGroup* items() { return m_items; }
56 QGraphicsItemGroup* items() { return m_items; }
57
57
58 // New stuff:
58 QList<QLegendMarker*> markers(QAbstractSeries *series = 0);
59 QList<QLegendMarker*> markers() { return m_markers; }
60 void addSeries(QAbstractSeries* series);
59 void addSeries(QAbstractSeries *series);
61 void removeSeries(QAbstractSeries* series);
60 void removeSeries(QAbstractSeries *series);
62
61
@@ -88,13 +87,12 private:
88 bool m_attachedToChart;
87 bool m_attachedToChart;
89 bool m_backgroundVisible;
88 bool m_backgroundVisible;
90
89
91 friend class QLegend;
92 friend class LegendLayout;
93 QList<QLegendMarker*> m_markers;
90 QList<QLegendMarker *> m_markers;
94 QList<QAbstractSeries*> m_series;
91 QList<QAbstractSeries *> m_series;
95
92
96 friend class QLegend;
93 friend class QLegend;
97 friend class LegendMarkerItem;
94 friend class LegendMarkerItem;
95 friend class LegendLayout;
98 };
96 };
99
97
100 QTCOMMERCIALCHART_END_NAMESPACE
98 QTCOMMERCIALCHART_END_NAMESPACE
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
1 NO CONTENT: modified file
NO CONTENT: modified file
General Comments 0
You need to be logged in to leave comments. Login now