@@ -463,7 +463,7 void ChartPresenter::updateLayout() | |||||
463 | break; |
|
463 | break; | |
464 | } |
|
464 | } | |
465 | case QLegend::AlignmentLeft: { |
|
465 | case QLegend::AlignmentLeft: { | |
466 |
int ledgendSize = legend->minWid |
|
466 | int ledgendSize = legend->minWidth(); | |
467 | int leftPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny + m_minLeftMargin; |
|
467 | int leftPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny + m_minLeftMargin; | |
468 | m_chartMargins = QRect(QPoint(leftPadding,m_chartMargins.top()),QPoint(m_chartMargins.right(),m_chartMargins.bottom())); |
|
468 | m_chartMargins = QRect(QPoint(leftPadding,m_chartMargins.top()),QPoint(m_chartMargins.right(),m_chartMargins.bottom())); | |
469 | m_legendMargins = QRect(QPoint(m_marginTiny + m_marginSmall,m_chartMargins.top()),QPoint(m_rect.width()-leftPadding + m_marginTiny + m_minLeftMargin,m_chartMargins.bottom())); |
|
469 | m_legendMargins = QRect(QPoint(m_marginTiny + m_marginSmall,m_chartMargins.top()),QPoint(m_rect.width()-leftPadding + m_marginTiny + m_minLeftMargin,m_chartMargins.bottom())); | |
@@ -471,7 +471,7 void ChartPresenter::updateLayout() | |||||
471 | break; |
|
471 | break; | |
472 | } |
|
472 | } | |
473 | case QLegend::AlignmentRight: { |
|
473 | case QLegend::AlignmentRight: { | |
474 |
int ledgendSize = legend->minWid |
|
474 | int ledgendSize = legend->minWidth(); | |
475 | int rightPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny; |
|
475 | int rightPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny; | |
476 | m_chartMargins = QRect(QPoint(m_chartMargins.left(),m_chartMargins.top()),QPoint(rightPadding,m_chartMargins.bottom())); |
|
476 | m_chartMargins = QRect(QPoint(m_chartMargins.left(),m_chartMargins.top()),QPoint(rightPadding,m_chartMargins.bottom())); | |
477 | m_legendMargins = QRect(QPoint(m_rect.width()- rightPadding+ m_marginTiny ,m_chartMargins.top()),QPoint(m_marginTiny + m_marginSmall,m_chartMargins.bottom())); |
|
477 | m_legendMargins = QRect(QPoint(m_rect.width()- rightPadding+ m_marginTiny ,m_chartMargins.top()),QPoint(m_marginTiny + m_marginSmall,m_chartMargins.bottom())); |
@@ -57,30 +57,24 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
57 | */ |
|
57 | */ | |
58 |
|
58 | |||
59 | /*! |
|
59 | /*! | |
60 |
\enum QLegend:: |
|
60 | \enum QLegend::Alignment | |
61 |
|
61 | |||
62 | This enum describes the possible position for legend inside chart. |
|
62 | This enum describes the possible position for legend inside chart. | |
63 |
|
63 | |||
64 |
\value |
|
64 | \value AlignmentTop | |
65 |
\value |
|
65 | \value AlignmentBottom | |
66 |
\value |
|
66 | \value AlignmentLeft | |
67 |
\value |
|
67 | \value AlignmentRight | |
68 | */ |
|
|||
69 |
|
||||
70 |
|
||||
71 | /*! |
|
|||
72 | \fn void QLegend::clicked(QSeries* series, Qt::MouseButton button) |
|
|||
73 | \brief Notifies when series has been clicked on legend \a series \a button |
|
|||
74 | */ |
|
68 | */ | |
75 |
|
69 | |||
76 | /*! |
|
70 | /*! | |
77 | \fn void QLegend::clicked(QBarSet* barset, Qt::MouseButton button) |
|
71 | \fn qreal QLegend::minWidth() const | |
78 | \brief Notifies when barset has been clicked on legend \a barset \a button |
|
72 | Returns minimum width of the legend | |
79 | */ |
|
73 | */ | |
80 |
|
74 | |||
81 | /*! |
|
75 | /*! | |
82 | \fn void QLegend::clicked(QPieSlice* slice, Qt::MouseButton button) |
|
76 | \fn qreal QLegend::minHeight() const | |
83 | \brief Notifies when pie slice has been clicked on legend \a slice \a button |
|
77 | Returns minimum height of the legend | |
84 | */ |
|
78 | */ | |
85 |
|
79 | |||
86 | /*! |
|
80 | /*! | |
@@ -172,8 +166,8 QPen QLegend::pen() const | |||||
172 | } |
|
166 | } | |
173 |
|
167 | |||
174 | /*! |
|
168 | /*! | |
175 |
Sets the \a |
|
169 | Sets the \a alignment for legend. Legend tries to paint itself on the defined position in chart. | |
176 |
\sa QLegend:: |
|
170 | \sa QLegend::Alignment | |
177 | */ |
|
171 | */ | |
178 | void QLegend::setAlignmnent(QLegend::Alignments alignment) |
|
172 | void QLegend::setAlignmnent(QLegend::Alignments alignment) | |
179 | { |
|
173 | { | |
@@ -481,6 +475,9 void QLegend::updateLayout() | |||||
481 | m_chart->d_ptr->m_presenter->updateLayout(); //TODO fixme; |
|
475 | m_chart->d_ptr->m_presenter->updateLayout(); //TODO fixme; | |
482 | } |
|
476 | } | |
483 |
|
477 | |||
|
478 | /*! | |||
|
479 | Sets the visibility of legend background to \a visible | |||
|
480 | */ | |||
484 | void QLegend::setBackgroundVisible(bool visible) |
|
481 | void QLegend::setBackgroundVisible(bool visible) | |
485 | { |
|
482 | { | |
486 | if(m_backgroundVisible!=visible) |
|
483 | if(m_backgroundVisible!=visible) | |
@@ -490,11 +487,17 void QLegend::setBackgroundVisible(bool visible) | |||||
490 | } |
|
487 | } | |
491 | } |
|
488 | } | |
492 |
|
489 | |||
|
490 | /*! | |||
|
491 | Returns the visibility of legend background | |||
|
492 | */ | |||
493 | bool QLegend::isBackgroundVisible() const |
|
493 | bool QLegend::isBackgroundVisible() const | |
494 | { |
|
494 | { | |
495 | return m_backgroundVisible; |
|
495 | return m_backgroundVisible; | |
496 | } |
|
496 | } | |
497 |
|
497 | |||
|
498 | /*! | |||
|
499 | \internal \a event see QGraphicsWidget for details | |||
|
500 | */ | |||
498 | void QLegend::resizeEvent(QGraphicsSceneResizeEvent *event) |
|
501 | void QLegend::resizeEvent(QGraphicsSceneResizeEvent *event) | |
499 | { |
|
502 | { | |
500 | const QRectF& rect = QRectF(QPoint(0,0),event->newSize()); |
|
503 | const QRectF& rect = QRectF(QPoint(0,0),event->newSize()); | |
@@ -505,6 +508,9 void QLegend::resizeEvent(QGraphicsSceneResizeEvent *event) | |||||
505 | } |
|
508 | } | |
506 | } |
|
509 | } | |
507 |
|
510 | |||
|
511 | /*! | |||
|
512 | \internal \a event see QGraphicsWidget for details | |||
|
513 | */ | |||
508 | void QLegend::hideEvent(QHideEvent *event) |
|
514 | void QLegend::hideEvent(QHideEvent *event) | |
509 | { |
|
515 | { | |
510 | QGraphicsWidget::hideEvent(event); |
|
516 | QGraphicsWidget::hideEvent(event); | |
@@ -512,6 +518,9 void QLegend::hideEvent(QHideEvent *event) | |||||
512 | updateLayout(); |
|
518 | updateLayout(); | |
513 | } |
|
519 | } | |
514 |
|
520 | |||
|
521 | /*! | |||
|
522 | \internal \a event see QGraphicsWidget for details | |||
|
523 | */ | |||
515 | void QLegend::showEvent(QShowEvent *event) |
|
524 | void QLegend::showEvent(QShowEvent *event) | |
516 | { |
|
525 | { | |
517 | QGraphicsWidget::showEvent(event); |
|
526 | QGraphicsWidget::showEvent(event); |
@@ -72,12 +72,11 public: | |||||
72 | void setAlignmnent(QLegend::Alignments alignment); |
|
72 | void setAlignmnent(QLegend::Alignments alignment); | |
73 | QLegend::Alignments alignment() const; |
|
73 | QLegend::Alignments alignment() const; | |
74 |
|
74 | |||
75 |
|
||||
76 | void detachFromChart(); |
|
75 | void detachFromChart(); | |
77 | void attachToChart(); |
|
76 | void attachToChart(); | |
78 | bool isAttachedToChart(); |
|
77 | bool isAttachedToChart(); | |
79 |
|
78 | |||
80 |
qreal minWid |
|
79 | qreal minWidth() const { return m_minWidth;} | |
81 | qreal minHeight() const { return m_minHeight;} |
|
80 | qreal minHeight() const { return m_minHeight;} | |
82 |
|
81 | |||
83 | void setBackgroundVisible(bool visible = true); |
|
82 | void setBackgroundVisible(bool visible = true); |
General Comments 0
You need to be logged in to leave comments.
Login now