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