@@ -118,8 +118,10 void LegendLayout::setAttachedGeometry(const QRectF &rect) | |||||
118 |
|
118 | |||
119 | QSizeF size(0, 0); |
|
119 | QSizeF size(0, 0); | |
120 |
|
120 | |||
121 |
if |
|
121 | // if( m_legend->d_ptr->markers().isEmpty()) return; | |
|
122 | if (m_legend->d_ptr->legendMarkers().isEmpty()) { | |||
122 | return; |
|
123 | return; | |
|
124 | } | |||
123 |
|
125 | |||
124 | m_width = 0; |
|
126 | m_width = 0; | |
125 | m_height = 0; |
|
127 | m_height = 0; | |
@@ -148,8 +150,9 void LegendLayout::setAttachedGeometry(const QRectF &rect) | |||||
148 | */ |
|
150 | */ | |
149 | // New markers -->> |
|
151 | // New markers -->> | |
150 | foreach (QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { |
|
152 | foreach (QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { | |
151 | if (marker->isVisible()) { |
|
153 | LegendMarkerItem* item = marker->d_ptr->item(); | |
152 | LegendMarkerItem* item = marker->d_ptr.data()->item(); |
|
154 | if (item->isVisible()) { | |
|
155 | // LegendMarkerItem* item = marker->d_ptr.data()->item(); | |||
153 | item->setGeometry(geometry); |
|
156 | item->setGeometry(geometry); | |
154 | item->setPos(point.x(),geometry.height()/2 - item->boundingRect().height()/2); |
|
157 | item->setPos(point.x(),geometry.height()/2 - item->boundingRect().height()/2); | |
155 | const QRectF& rect = item->boundingRect(); |
|
158 | const QRectF& rect = item->boundingRect(); | |
@@ -185,8 +188,9 void LegendLayout::setAttachedGeometry(const QRectF &rect) | |||||
185 | */ |
|
188 | */ | |
186 | // New markers -->> |
|
189 | // New markers -->> | |
187 | foreach (QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { |
|
190 | foreach (QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { | |
188 | if (marker->isVisible()) { |
|
191 | LegendMarkerItem* item = marker->d_ptr->item(); | |
189 | LegendMarkerItem* item = marker->d_ptr.data()->item(); |
|
192 | if (item->isVisible()) { | |
|
193 | // LegendMarkerItem* item = marker->d_ptr->item(); | |||
190 | item->setGeometry(geometry); |
|
194 | item->setGeometry(geometry); | |
191 | item->setPos(point); |
|
195 | item->setPos(point); | |
192 | const QRectF& rect = item->boundingRect(); |
|
196 | const QRectF& rect = item->boundingRect(); | |
@@ -232,7 +236,8 void LegendLayout::setDettachedGeometry(const QRectF &rect) | |||||
232 |
|
236 | |||
233 | QSizeF size(0, 0); |
|
237 | QSizeF size(0, 0); | |
234 |
|
238 | |||
235 | QList<LegendMarker *> markers = m_legend->d_ptr->markers(); |
|
239 | // QList<LegendMarker *> markers = m_legend->d_ptr->markers(); | |
|
240 | QList<QLegendMarker *> markers = m_legend->d_ptr->legendMarkers(); | |||
236 |
|
241 | |||
237 | if (markers.isEmpty()) |
|
242 | if (markers.isEmpty()) | |
238 | return; |
|
243 | return; | |
@@ -243,6 +248,7 void LegendLayout::setDettachedGeometry(const QRectF &rect) | |||||
243 | m_width = 0; |
|
248 | m_width = 0; | |
244 | m_height = 0; |
|
249 | m_height = 0; | |
245 | for (int i = 0; i < markers.count(); i++) { |
|
250 | for (int i = 0; i < markers.count(); i++) { | |
|
251 | /* | |||
246 | LegendMarker *marker = markers.at(i); |
|
252 | LegendMarker *marker = markers.at(i); | |
247 | if (marker->isVisible()) { |
|
253 | if (marker->isVisible()) { | |
248 | marker->setGeometry(geometry); |
|
254 | marker->setGeometry(geometry); | |
@@ -262,6 +268,28 void LegendLayout::setDettachedGeometry(const QRectF &rect) | |||||
262 | } |
|
268 | } | |
263 | } |
|
269 | } | |
264 | } |
|
270 | } | |
|
271 | */ | |||
|
272 | // QLegendMarker *marker = markers.at(i); | |||
|
273 | LegendMarkerItem *item = markers.at(i)->d_ptr->item(); | |||
|
274 | if (item->isVisible()) { | |||
|
275 | // LegendMarkerItem *item = marker->d_ptr->item(); | |||
|
276 | item->setGeometry(geometry); | |||
|
277 | item->setPos(point.x(),point.y()); | |||
|
278 | const QRectF& boundingRect = item->boundingRect(); | |||
|
279 | qreal w = boundingRect.width(); | |||
|
280 | qreal h = boundingRect.height(); | |||
|
281 | m_width = qMax(m_width,w); | |||
|
282 | m_height = qMax(m_height,h); | |||
|
283 | point.setX(point.x() + w); | |||
|
284 | if (point.x() + w > geometry.left() + geometry.width() - right) { | |||
|
285 | // Next item would go off rect. | |||
|
286 | point.setX(0); | |||
|
287 | point.setY(point.y() + h); | |||
|
288 | if (i+1 < markers.count()) { | |||
|
289 | m_height += h; | |||
|
290 | } | |||
|
291 | } | |||
|
292 | } | |||
265 | } |
|
293 | } | |
266 | m_legend->d_ptr->items()->setPos(geometry.topLeft()); |
|
294 | m_legend->d_ptr->items()->setPos(geometry.topLeft()); | |
267 |
|
295 | |||
@@ -276,6 +304,7 void LegendLayout::setDettachedGeometry(const QRectF &rect) | |||||
276 | m_width = 0; |
|
304 | m_width = 0; | |
277 | m_height = 0; |
|
305 | m_height = 0; | |
278 | for (int i = 0; i < markers.count(); i++) { |
|
306 | for (int i = 0; i < markers.count(); i++) { | |
|
307 | /* | |||
279 | LegendMarker *marker = markers.at(i); |
|
308 | LegendMarker *marker = markers.at(i); | |
280 | if (marker->isVisible()) { |
|
309 | if (marker->isVisible()) { | |
281 | marker->setGeometry(geometry); |
|
310 | marker->setGeometry(geometry); | |
@@ -295,6 +324,27 void LegendLayout::setDettachedGeometry(const QRectF &rect) | |||||
295 | } |
|
324 | } | |
296 | } |
|
325 | } | |
297 | } |
|
326 | } | |
|
327 | */ | |||
|
328 | // QLegendMarker *marker = markers.at(i); | |||
|
329 | LegendMarkerItem *item = markers.at(i)->d_ptr->item(); | |||
|
330 | if (item->isVisible()) { | |||
|
331 | item->setGeometry(geometry); | |||
|
332 | const QRectF& boundingRect = item->boundingRect(); | |||
|
333 | qreal w = boundingRect.width(); | |||
|
334 | qreal h = boundingRect.height(); | |||
|
335 | m_width = qMax(m_width,w); | |||
|
336 | m_height = qMax(m_height,h); | |||
|
337 | item->setPos(point.x(),point.y() - h); | |||
|
338 | point.setX(point.x() + w); | |||
|
339 | if (point.x() + w > geometry.left() + geometry.width() - right) { | |||
|
340 | // Next item would go off rect. | |||
|
341 | point.setX(0); | |||
|
342 | point.setY(point.y() - h); | |||
|
343 | if (i+1 < markers.count()) { | |||
|
344 | m_height += h; | |||
|
345 | } | |||
|
346 | } | |||
|
347 | } | |||
298 | } |
|
348 | } | |
299 |
|
|
349 | m_legend->d_ptr->items()->setPos(geometry.topLeft()); | |
300 |
|
350 | |||
@@ -310,6 +360,7 void LegendLayout::setDettachedGeometry(const QRectF &rect) | |||||
310 | m_height = 0; |
|
360 | m_height = 0; | |
311 | qreal maxWidth = 0; |
|
361 | qreal maxWidth = 0; | |
312 | for (int i = 0; i < markers.count(); i++) { |
|
362 | for (int i = 0; i < markers.count(); i++) { | |
|
363 | /* | |||
313 | LegendMarker *marker = markers.at(i); |
|
364 | LegendMarker *marker = markers.at(i); | |
314 | if (marker->isVisible()) { |
|
365 | if (marker->isVisible()) { | |
315 | marker->setGeometry(geometry); |
|
366 | marker->setGeometry(geometry); | |
@@ -330,6 +381,29 void LegendLayout::setDettachedGeometry(const QRectF &rect) | |||||
330 | } |
|
381 | } | |
331 | } |
|
382 | } | |
332 | } |
|
383 | } | |
|
384 | */ | |||
|
385 | // QLegendMarker *marker = markers.at(i); | |||
|
386 | LegendMarkerItem *item = markers.at(i)->d_ptr->item(); | |||
|
387 | if (item->isVisible()) { | |||
|
388 | // LegendMarkerItem *item = marker->d_ptr->item(); | |||
|
389 | item->setGeometry(geometry); | |||
|
390 | const QRectF& boundingRect = item->boundingRect(); | |||
|
391 | qreal w = boundingRect.width(); | |||
|
392 | qreal h = boundingRect.height(); | |||
|
393 | m_height = qMax(m_height,h); | |||
|
394 | maxWidth = qMax(maxWidth,w); | |||
|
395 | item->setPos(point.x(),point.y()); | |||
|
396 | point.setY(point.y() + h); | |||
|
397 | if (point.y() + h > geometry.bottom() - bottom) { | |||
|
398 | // Next item would go off rect. | |||
|
399 | point.setX(point.x() + maxWidth); | |||
|
400 | point.setY(0); | |||
|
401 | if (i+1 < markers.count()) { | |||
|
402 | m_width += maxWidth; | |||
|
403 | maxWidth = 0; | |||
|
404 | } | |||
|
405 | } | |||
|
406 | } | |||
333 | } |
|
407 | } | |
334 |
|
|
408 | m_width += maxWidth; | |
335 |
|
|
409 | m_legend->d_ptr->items()->setPos(geometry.topLeft()); | |
@@ -346,6 +420,7 void LegendLayout::setDettachedGeometry(const QRectF &rect) | |||||
346 | m_height = 0; |
|
420 | m_height = 0; | |
347 | qreal maxWidth = 0; |
|
421 | qreal maxWidth = 0; | |
348 | for (int i = 0; i < markers.count(); i++) { |
|
422 | for (int i = 0; i < markers.count(); i++) { | |
|
423 | /* | |||
349 | LegendMarker *marker = markers.at(i); |
|
424 | LegendMarker *marker = markers.at(i); | |
350 | if (marker->isVisible()) { |
|
425 | if (marker->isVisible()) { | |
351 | marker->setGeometry(geometry); |
|
426 | marker->setGeometry(geometry); | |
@@ -366,6 +441,29 void LegendLayout::setDettachedGeometry(const QRectF &rect) | |||||
366 | } |
|
441 | } | |
367 | } |
|
442 | } | |
368 | } |
|
443 | } | |
|
444 | */ | |||
|
445 | // QLegendMarker *marker = markers.at(i); | |||
|
446 | LegendMarkerItem *item = markers.at(i)->d_ptr->item(); | |||
|
447 | if (item->isVisible()) { | |||
|
448 | // LegendMarkerItem *item = marker->d_ptr->item(); | |||
|
449 | item->setGeometry(geometry); | |||
|
450 | const QRectF& boundingRect = item->boundingRect(); | |||
|
451 | qreal w = boundingRect.width(); | |||
|
452 | qreal h = boundingRect.height(); | |||
|
453 | m_height = qMax(m_height,h); | |||
|
454 | maxWidth = qMax(maxWidth,w); | |||
|
455 | item->setPos(point.x() - w,point.y()); | |||
|
456 | point.setY(point.y() + h); | |||
|
457 | if (point.y() + h > geometry.bottom()-bottom) { | |||
|
458 | // Next item would go off rect. | |||
|
459 | point.setX(point.x() - maxWidth); | |||
|
460 | point.setY(0); | |||
|
461 | if (i+1 < markers.count()) { | |||
|
462 | m_width += maxWidth; | |||
|
463 | maxWidth = 0; | |||
|
464 | } | |||
|
465 | } | |||
|
466 | } | |||
369 | } |
|
467 | } | |
370 |
|
|
468 | m_width += maxWidth; | |
371 |
|
|
469 | m_legend->d_ptr->items()->setPos(geometry.topLeft()); | |
@@ -424,7 +522,7 QSizeF LegendLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) cons | |||||
424 |
|
522 | |||
425 | if(constraint.isValid()) { |
|
523 | if(constraint.isValid()) { | |
426 | foreach(QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { |
|
524 | foreach(QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { | |
427 |
LegendMarkerItem *item = marker->d_ptr |
|
525 | LegendMarkerItem *item = marker->d_ptr->item(); | |
428 | size = size.expandedTo(item->effectiveSizeHint(which)); |
|
526 | size = size.expandedTo(item->effectiveSizeHint(which)); | |
429 | } |
|
527 | } | |
430 | size = size.boundedTo(constraint); |
|
528 | size = size.boundedTo(constraint); | |
@@ -433,7 +531,7 QSizeF LegendLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) cons | |||||
433 | qreal width = 0; |
|
531 | qreal width = 0; | |
434 | qreal height = 0; |
|
532 | qreal height = 0; | |
435 | foreach(QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { |
|
533 | foreach(QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { | |
436 |
LegendMarkerItem *item = marker->d_ptr |
|
534 | LegendMarkerItem *item = marker->d_ptr->item(); | |
437 | width+=item->effectiveSizeHint(which).width(); |
|
535 | width+=item->effectiveSizeHint(which).width(); | |
438 | height=qMax(height,item->effectiveSizeHint(which).height()); |
|
536 | height=qMax(height,item->effectiveSizeHint(which).height()); | |
439 | } |
|
537 | } | |
@@ -444,7 +542,7 QSizeF LegendLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) cons | |||||
444 | qreal width = 0; |
|
542 | qreal width = 0; | |
445 | qreal height = 0; |
|
543 | qreal height = 0; | |
446 | foreach(QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { |
|
544 | foreach(QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { | |
447 |
LegendMarkerItem *item = marker->d_ptr |
|
545 | LegendMarkerItem *item = marker->d_ptr->item(); | |
448 | width=qMax(width,item->effectiveSizeHint(which).width()); |
|
546 | width=qMax(width,item->effectiveSizeHint(which).width()); | |
449 | height+=height,item->effectiveSizeHint(which).height(); |
|
547 | height+=height,item->effectiveSizeHint(which).height(); | |
450 | } |
|
548 | } | |
@@ -452,7 +550,7 QSizeF LegendLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) cons | |||||
452 | } |
|
550 | } | |
453 | else { |
|
551 | else { | |
454 | foreach(QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { |
|
552 | foreach(QLegendMarker* marker, m_legend->d_ptr->legendMarkers()) { | |
455 |
LegendMarkerItem *item = marker->d_ptr |
|
553 | LegendMarkerItem *item = marker->d_ptr->item(); | |
456 | size = size.expandedTo(item->effectiveSizeHint(which)); |
|
554 | size = size.expandedTo(item->effectiveSizeHint(which)); | |
457 | } |
|
555 | } | |
458 | } |
|
556 | } |
@@ -33,17 +33,13 LegendMarkerItem::LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject | |||||
33 | QGraphicsObject(parent), |
|
33 | QGraphicsObject(parent), | |
34 | m_marker(marker), |
|
34 | m_marker(marker), | |
35 | m_markerRect(0,0,10.0,10.0), |
|
35 | m_markerRect(0,0,10.0,10.0), | |
36 |
m_boundingRect(0,0, |
|
36 | m_boundingRect(0,0,0,0), | |
37 | m_textItem(new QGraphicsSimpleTextItem(this)), |
|
37 | m_textItem(new QGraphicsSimpleTextItem(this)), | |
38 | m_rectItem(new QGraphicsRectItem(this)), |
|
38 | m_rectItem(new QGraphicsRectItem(this)), | |
39 | m_margin(4), |
|
39 | m_margin(4), | |
40 | m_space(4) |
|
40 | m_space(4) | |
41 | { |
|
41 | { | |
42 | // qDebug() << "LegendMarkerItem created for marker:" << m_marker; |
|
|||
43 | // setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton); |
|
|||
44 | m_rectItem->setRect(m_markerRect); |
|
42 | m_rectItem->setRect(m_markerRect); | |
45 | // setZValue(zValue() + 20); |
|
|||
46 | // qDebug() << "z:" << this->zValue(); |
|
|||
47 | } |
|
43 | } | |
48 |
|
44 | |||
49 | void LegendMarkerItem::setPen(const QPen &pen) |
|
45 | void LegendMarkerItem::setPen(const QPen &pen) | |
@@ -81,7 +77,6 QFont LegendMarkerItem::font() const | |||||
81 |
|
77 | |||
82 | void LegendMarkerItem::setLabel(const QString label) |
|
78 | void LegendMarkerItem::setLabel(const QString label) | |
83 | { |
|
79 | { | |
84 | qDebug() << "LegendMarkerItem::setlabel" << label; |
|
|||
85 | m_text = label; |
|
80 | m_text = label; | |
86 | updateGeometry(); |
|
81 | updateGeometry(); | |
87 | } |
|
82 | } |
@@ -476,26 +476,18 int QLegendPrivate::roundness(qreal size) | |||||
476 |
|
476 | |||
477 | void QLegendPrivate::appendSeries(QAbstractSeries* series) |
|
477 | void QLegendPrivate::appendSeries(QAbstractSeries* series) | |
478 | { |
|
478 | { | |
479 | Q_UNUSED(series); |
|
|||
480 | // TODO: |
|
|||
481 | /* |
|
|||
482 | if (!m_series.contains(series)) { |
|
479 | if (!m_series.contains(series)) { | |
483 | m_series.append(series); |
|
480 | m_series.append(series); | |
484 |
handleSeriesAdded(series,0); |
|
481 | handleSeriesAdded(series,0); | |
485 | } |
|
482 | } | |
486 | */ |
|
|||
487 | } |
|
483 | } | |
488 |
|
484 | |||
489 | void QLegendPrivate::removeSeries(QAbstractSeries* series) |
|
485 | void QLegendPrivate::removeSeries(QAbstractSeries* series) | |
490 | { |
|
486 | { | |
491 | Q_UNUSED(series); |
|
|||
492 | // TODO: |
|
|||
493 | /* |
|
|||
494 | if (m_series.contains(series)) { |
|
487 | if (m_series.contains(series)) { | |
495 | m_series.removeOne(series); |
|
488 | m_series.removeOne(series); | |
496 | handleSeriesRemoved(series); |
|
489 | handleSeriesRemoved(series); | |
497 | } |
|
490 | } | |
498 | */ |
|
|||
499 | } |
|
491 | } | |
500 |
|
492 | |||
501 | void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain) |
|
493 | void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain) | |
@@ -517,6 +509,7 void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain) | |||||
517 | QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged())); |
|
509 | QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged())); | |
518 | // <--- New markers |
|
510 | // <--- New markers | |
519 |
|
511 | |||
|
512 | /* | |||
520 | QList<LegendMarker*> markers = series->d_ptr->createLegendMarker(q_ptr); |
|
513 | QList<LegendMarker*> markers = series->d_ptr->createLegendMarker(q_ptr); | |
521 |
|
|
514 | ||
522 | foreach (LegendMarker *marker, markers) { |
|
515 | foreach (LegendMarker *marker, markers) { | |
@@ -526,6 +519,7 void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series, Domain *domain) | |||||
526 | m_items->addToGroup(marker); |
|
519 | m_items->addToGroup(marker); | |
527 | m_markers << marker; |
|
520 | m_markers << marker; | |
528 | } |
|
521 | } | |
|
522 | */ | |||
529 |
|
523 | |||
530 | QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged())); |
|
524 | QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged())); | |
531 | QObject::connect(series->d_ptr.data(), SIGNAL(countChanged()), this, SLOT(handleCountChanged())); |
|
525 | QObject::connect(series->d_ptr.data(), SIGNAL(countChanged()), this, SLOT(handleCountChanged())); | |
@@ -539,6 +533,8 void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series) | |||||
539 | // New markers ---> |
|
533 | // New markers ---> | |
540 | foreach (QLegendMarker *marker, m_legendMarkers) { |
|
534 | foreach (QLegendMarker *marker, m_legendMarkers) { | |
541 | if (marker->series() == series) { |
|
535 | if (marker->series() == series) { | |
|
536 | marker->d_ptr.data()->item()->setVisible(false); | |||
|
537 | m_items->removeFromGroup(marker->d_ptr.data()->item()); | |||
542 | delete marker; |
|
538 | delete marker; | |
543 | m_legendMarkers.removeAll(marker); |
|
539 | m_legendMarkers.removeAll(marker); | |
544 | } |
|
540 | } | |
@@ -547,13 +543,14 void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series) | |||||
547 | QObject::disconnect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged())); |
|
543 | QObject::disconnect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged())); | |
548 | // <--- New markers |
|
544 | // <--- New markers | |
549 |
|
545 | |||
|
546 | /* | |||
550 | foreach (LegendMarker *marker, m_markers) { |
|
547 | foreach (LegendMarker *marker, m_markers) { | |
551 | if (marker->series() == series) { |
|
548 | if (marker->series() == series) { | |
552 | delete marker; |
|
549 | delete marker; | |
553 | m_markers.removeAll(marker); |
|
550 | m_markers.removeAll(marker); | |
554 | } |
|
551 | } | |
555 | } |
|
552 | } | |
556 |
|
553 | */ | ||
557 | QObject::disconnect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged())); |
|
554 | QObject::disconnect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged())); | |
558 | QObject::disconnect(series->d_ptr.data(), SIGNAL(countChanged()), this, SLOT(handleCountChanged())); |
|
555 | QObject::disconnect(series->d_ptr.data(), SIGNAL(countChanged()), this, SLOT(handleCountChanged())); | |
559 | m_layout->invalidate(); |
|
556 | m_layout->invalidate(); | |
@@ -572,17 +569,19 void QLegendPrivate::handleSeriesVisibleChanged() | |||||
572 | } |
|
569 | } | |
573 |
|
570 | |||
574 | // <--- New markers |
|
571 | // <--- New markers | |
575 |
|
572 | /* | ||
576 | foreach (LegendMarker* marker, m_markers) { |
|
573 | foreach (LegendMarker* marker, m_markers) { | |
577 | if (marker->series() == series) { |
|
574 | if (marker->series() == series) { | |
578 | marker->setVisible(series->isVisible()); |
|
575 | marker->setVisible(series->isVisible()); | |
579 | } |
|
576 | } | |
|
577 | */ | |||
580 | m_layout->invalidate(); |
|
578 | m_layout->invalidate(); | |
581 | } |
|
579 | } | |
582 |
|
580 | |||
583 | void QLegendPrivate::handleCountChanged() |
|
581 | void QLegendPrivate::handleCountChanged() | |
584 | { |
|
582 | { | |
585 | // With new markers, the series shoud notify markers directly? |
|
583 | // With new markers, the series shoud notify markers directly? | |
|
584 | qDebug() << "handleLegendPropertiesUpdated"; | |||
586 |
|
585 | |||
587 | // Handle new or removed markers |
|
586 | // Handle new or removed markers | |
588 | // Handle changes of marker pen/brush/label. every property that legend is interested |
|
587 | // Handle changes of marker pen/brush/label. every property that legend is interested |
@@ -113,6 +113,7 QLegendMarkerPrivate::QLegendMarkerPrivate(QLegendMarker *q) : | |||||
113 |
|
113 | |||
114 | QLegendMarkerPrivate::~QLegendMarkerPrivate() |
|
114 | QLegendMarkerPrivate::~QLegendMarkerPrivate() | |
115 | { |
|
115 | { | |
|
116 | // delete m_item; | |||
116 | } |
|
117 | } | |
117 |
|
118 | |||
118 | void QLegendMarkerPrivate::handleMousePressEvent(QGraphicsSceneEvent *event) |
|
119 | void QLegendMarkerPrivate::handleMousePressEvent(QGraphicsSceneEvent *event) |
@@ -32,6 +32,7 QPieLegendMarker::QPieLegendMarker(QPieSeries* series, QPieSlice* slice, QObject | |||||
32 |
|
32 | |||
33 | QPieLegendMarker::~QPieLegendMarker() |
|
33 | QPieLegendMarker::~QPieLegendMarker() | |
34 | { |
|
34 | { | |
|
35 | qDebug() << "deleting pie marker" << this; | |||
35 | } |
|
36 | } | |
36 |
|
37 | |||
37 | /*! |
|
38 | /*! | |
@@ -61,7 +62,7 QPieLegendMarkerPrivate::QPieLegendMarkerPrivate(QPieSeries *series, QPieSlice * | |||||
61 | m_series(series), |
|
62 | m_series(series), | |
62 | m_slice(slice) |
|
63 | m_slice(slice) | |
63 | { |
|
64 | { | |
64 | qDebug() << "QPieLegendMarkerPrivate created"; |
|
65 | // qDebug() << "QPieLegendMarkerPrivate created"; | |
65 | QObject::connect(m_slice, SIGNAL(labelChanged()), this, SLOT(updated())); |
|
66 | QObject::connect(m_slice, SIGNAL(labelChanged()), this, SLOT(updated())); | |
66 | QObject::connect(m_slice, SIGNAL(brushChanged()), this, SLOT(updated())); |
|
67 | QObject::connect(m_slice, SIGNAL(brushChanged()), this, SLOT(updated())); | |
67 | updated(); |
|
68 | updated(); | |
@@ -75,7 +76,7 QPieLegendMarkerPrivate::~QPieLegendMarkerPrivate() | |||||
75 |
|
76 | |||
76 | void QPieLegendMarkerPrivate::updated() |
|
77 | void QPieLegendMarkerPrivate::updated() | |
77 | { |
|
78 | { | |
78 | qDebug() << "QPieLegendMarkerPrivate::updated"; |
|
79 | // qDebug() << "QPieLegendMarkerPrivate::updated"; | |
79 | m_item->setBrush(m_slice->brush()); |
|
80 | m_item->setBrush(m_slice->brush()); | |
80 | m_item->setLabel(m_slice->label()); |
|
81 | m_item->setLabel(m_slice->label()); | |
81 | m_item->setPen(m_slice->pen()); |
|
82 | m_item->setPen(m_slice->pen()); |
General Comments 0
You need to be logged in to leave comments.
Login now