##// END OF EJS Templates
legend documentation fix. detaching and attaching the legend
sauimone -
r728:7d3fdc2fff63
parent child
Show More
@@ -54,6 +54,7
54 <li><a href="qsplineseries.html">QSplineSeries</a></li>
54 <li><a href="qsplineseries.html">QSplineSeries</a></li>
55 <li><a href="qstackedbarseries.html">QStackedBarSeries</a></li>
55 <li><a href="qstackedbarseries.html">QStackedBarSeries</a></li>
56 <li><a href="qxyseries.html">QXYSeries</a></li>
56 <li><a href="qxyseries.html">QXYSeries</a></li>
57 <li><a href="qlegend.html">QLegend</a></li>
57 </ul>
58 </ul>
58 </td>
59 </td>
59 </tr>
60 </tr>
@@ -266,9 +266,39 QChartAxis* QChart::axisY() const
266 /*!
266 /*!
267 Returns the legend object of the chart. Ownership stays in chart.
267 Returns the legend object of the chart. Ownership stays in chart.
268 */
268 */
269 QLegend* QChart::legend() const
269 QLegend& QChart::legend() const
270 {
270 {
271 return m_legend;
271 return *m_legend;
272 }
273
274 /*!
275 Gives ownership of legend to user.
276 */
277 QLegend* QChart::takeLegend()
278 {
279 QLegend* l = m_legend;
280 m_legend = 0;
281 return l;
282 }
283
284 /*!
285 Gives ownership of legend back to chart. QChart takes ownership of \a legend and deletes existing one
286 */
287 void QChart::giveLegend(QLegend* legend)
288 {
289 if (m_legend) {
290 // Should not happen.
291 qDebug() << "Warning! Giving more than one legend to chart."
292 delete m_legend;
293 }
294
295 m_legend = legend;
296
297 // Reconnect legend, in case not already connected.
298 disconnect(m_dataset,SIGNAL(seriesAdded(QSeries*,Domain*)),m_legend,SLOT(handleSeriesAdded(QSeries*,Domain*)));
299 disconnect(m_dataset,SIGNAL(seriesRemoved(QSeries*)),m_legend,SLOT(handleSeriesRemoved(QSeries*)));
300 connect(m_dataset,SIGNAL(seriesAdded(QSeries*,Domain*)),m_legend,SLOT(handleSeriesAdded(QSeries*,Domain*)));
301 connect(m_dataset,SIGNAL(seriesRemoved(QSeries*)),m_legend,SLOT(handleSeriesRemoved(QSeries*)));
272 }
302 }
273
303
274 /*!
304 /*!
@@ -87,7 +87,9 public:
87 QChartAxis* axisX() const;
87 QChartAxis* axisX() const;
88 QChartAxis* axisY() const;
88 QChartAxis* axisY() const;
89
89
90 QLegend* legend() const;
90 QLegend& legend() const;
91 QLegend* takeLegend();
92 void giveLegend(QLegend* legend);
91
93
92 int padding() const;
94 int padding() const;
93
95
@@ -23,6 +23,20
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24
24
25 /*!
25 /*!
26 \class QLegend
27 \brief part of QtCommercial chart API.
28
29 QLegend is a graphical object, whics displays legend of the chart. Legend state is updated by QChart, when
30 series have been changed. By default, legend is drawn by QChart, but user can set a new parent to legend and
31 handle the drawing manually.
32 User isn't supposed to create or delete legend objects, but can reference it via QChart class.
33
34 \mainclass
35
36 \sa QChart, QSeries
37 */
38
39 /*!
26 \enum QLegend::PreferredLayout
40 \enum QLegend::PreferredLayout
27
41
28 This enum describes the possible position for legend inside chart.
42 This enum describes the possible position for legend inside chart.
@@ -35,17 +49,17 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35
49
36
50
37 /*!
51 /*!
38 \fn void clicked(QSeries* series, Qt::MouseButton button)
52 \fn void QLegend::clicked(QSeries* series, Qt::MouseButton button)
39 \brief Notifies when series has been clicked on legend \a series \a button
53 \brief Notifies when series has been clicked on legend \a series \a button
40 */
54 */
41
55
42 /*!
56 /*!
43 \fn void clicked(QBarSet* barset, Qt::MouseButton button);
57 \fn void QLegend::clicked(QBarSet* barset, Qt::MouseButton button)
44 \brief Notifies when barset has been clicked on legend \a barset \a button
58 \brief Notifies when barset has been clicked on legend \a barset \a button
45 */
59 */
46
60
47 /*!
61 /*!
48 \fn void clicked(QPieSlice* slice, Qt::MouseButton button);
62 \fn void QLegend::clicked(QPieSlice* slice, Qt::MouseButton button)
49 \brief Notifies when pie slice has been clicked on legend \a slice \a button
63 \brief Notifies when pie slice has been clicked on legend \a slice \a button
50 */
64 */
51
65
@@ -141,7 +155,7 QPen QLegend::pen() const
141
155
142 /*!
156 /*!
143 Sets the \a preferred layout for legend. Legend tries to paint itself on the defined position in chart.
157 Sets the \a preferred layout for legend. Legend tries to paint itself on the defined position in chart.
144 sa \QLegend::PreferredLayout
158 \sa QLegend::PreferredLayout
145 */
159 */
146 void QLegend::setPreferredLayout(QLegend::PreferredLayout preferred)
160 void QLegend::setPreferredLayout(QLegend::PreferredLayout preferred)
147 {
161 {
General Comments 0
You need to be logged in to leave comments. Login now