diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp index 371f445..ba8abc8 100644 --- a/src/chartpresenter.cpp +++ b/src/chartpresenter.cpp @@ -463,7 +463,7 @@ void ChartPresenter::updateLayout() break; } case QLegend::AlignmentLeft: { - int ledgendSize = legend->minWidht(); + int ledgendSize = legend->minWidth(); int leftPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny + m_minLeftMargin; m_chartMargins = QRect(QPoint(leftPadding,m_chartMargins.top()),QPoint(m_chartMargins.right(),m_chartMargins.bottom())); 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() break; } case QLegend::AlignmentRight: { - int ledgendSize = legend->minWidht(); + int ledgendSize = legend->minWidth(); int rightPadding = m_marginTiny + m_marginSmall + ledgendSize + m_marginTiny; m_chartMargins = QRect(QPoint(m_chartMargins.left(),m_chartMargins.top()),QPoint(rightPadding,m_chartMargins.bottom())); m_legendMargins = QRect(QPoint(m_rect.width()- rightPadding+ m_marginTiny ,m_chartMargins.top()),QPoint(m_marginTiny + m_marginSmall,m_chartMargins.bottom())); diff --git a/src/qlegend.cpp b/src/qlegend.cpp index 357cb5c..80d4331 100644 --- a/src/qlegend.cpp +++ b/src/qlegend.cpp @@ -57,30 +57,24 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! - \enum QLegend::Layout + \enum QLegend::Alignment This enum describes the possible position for legend inside chart. - \value LayoutTop - \value LayoutBottom - \value LayoutLeft - \value LayoutRight -*/ - - -/*! - \fn void QLegend::clicked(QSeries* series, Qt::MouseButton button) - \brief Notifies when series has been clicked on legend \a series \a button + \value AlignmentTop + \value AlignmentBottom + \value AlignmentLeft + \value AlignmentRight */ /*! - \fn void QLegend::clicked(QBarSet* barset, Qt::MouseButton button) - \brief Notifies when barset has been clicked on legend \a barset \a button + \fn qreal QLegend::minWidth() const + Returns minimum width of the legend */ /*! - \fn void QLegend::clicked(QPieSlice* slice, Qt::MouseButton button) - \brief Notifies when pie slice has been clicked on legend \a slice \a button + \fn qreal QLegend::minHeight() const + Returns minimum height of the legend */ /*! @@ -172,8 +166,8 @@ QPen QLegend::pen() const } /*! - Sets the \a preferred layout for legend. Legend tries to paint itself on the defined position in chart. - \sa QLegend::Layout + Sets the \a alignment for legend. Legend tries to paint itself on the defined position in chart. + \sa QLegend::Alignment */ void QLegend::setAlignmnent(QLegend::Alignments alignment) { @@ -481,6 +475,9 @@ void QLegend::updateLayout() m_chart->d_ptr->m_presenter->updateLayout(); //TODO fixme; } +/*! + Sets the visibility of legend background to \a visible +*/ void QLegend::setBackgroundVisible(bool visible) { if(m_backgroundVisible!=visible) @@ -490,11 +487,17 @@ void QLegend::setBackgroundVisible(bool visible) } } +/*! + Returns the visibility of legend background +*/ bool QLegend::isBackgroundVisible() const { return m_backgroundVisible; } +/*! + \internal \a event see QGraphicsWidget for details +*/ void QLegend::resizeEvent(QGraphicsSceneResizeEvent *event) { const QRectF& rect = QRectF(QPoint(0,0),event->newSize()); @@ -505,6 +508,9 @@ void QLegend::resizeEvent(QGraphicsSceneResizeEvent *event) } } +/*! + \internal \a event see QGraphicsWidget for details +*/ void QLegend::hideEvent(QHideEvent *event) { QGraphicsWidget::hideEvent(event); @@ -512,6 +518,9 @@ void QLegend::hideEvent(QHideEvent *event) updateLayout(); } +/*! + \internal \a event see QGraphicsWidget for details +*/ void QLegend::showEvent(QShowEvent *event) { QGraphicsWidget::showEvent(event); diff --git a/src/qlegend.h b/src/qlegend.h index f40efeb..6d50af3 100644 --- a/src/qlegend.h +++ b/src/qlegend.h @@ -72,12 +72,11 @@ public: void setAlignmnent(QLegend::Alignments alignment); QLegend::Alignments alignment() const; - void detachFromChart(); void attachToChart(); bool isAttachedToChart(); - qreal minWidht() const { return m_minWidth;} + qreal minWidth() const { return m_minWidth;} qreal minHeight() const { return m_minHeight;} void setBackgroundVisible(bool visible = true);