From e14529020653fc7c315a21ae7874fec7dbcb8d4c 2012-03-07 12:54:20 From: sauimone Date: 2012-03-07 12:54:20 Subject: [PATCH] removed old barlabel implementation --- diff --git a/src/barchart/barchart.pri b/src/barchart/barchart.pri index 2c126d8..bf59961 100644 --- a/src/barchart/barchart.pri +++ b/src/barchart/barchart.pri @@ -4,7 +4,6 @@ DEPENDPATH += $$PWD SOURCES += \ $$PWD/bar.cpp \ $$PWD/barchartmodel.cpp \ - $$PWD/barlabel.cpp \ $$PWD/barpresenter.cpp \ $$PWD/barpresenterbase.cpp \ $$PWD/percentbarpresenter.cpp \ @@ -19,7 +18,6 @@ SOURCES += \ PRIVATE_HEADERS += \ $$PWD/bar_p.h \ $$PWD/barchartmodel_p.h \ - $$PWD/barlabel_p.h \ $$PWD/barpresenter_p.h \ $$PWD/barpresenterbase_p.h \ $$PWD/percentbarpresenter_p.h \ diff --git a/src/barchart/barlabel.cpp b/src/barchart/barlabel.cpp deleted file mode 100644 index 6f8c635..0000000 --- a/src/barchart/barlabel.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "barlabel_p.h" -#include -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -BarLabel::BarLabel(QGraphicsItem* parent) : ChartItem(parent) -{ -} - -void BarLabel::set(QString label) -{ - mLabel = label; -} - -void BarLabel::setPos(qreal x, qreal y) -{ - mXpos = x; - mYpos = y; -} - -void BarLabel::setSize(const QSizeF &size) -{ - mSize = size; -} - -void BarLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - painter->drawText(boundingRect(),mLabel); -} - -QRectF BarLabel::boundingRect() const -{ - QRectF r(mXpos, mYpos, mSize.width(), mSize.height()); - return r; -} - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/barlabel_p.h b/src/barchart/barlabel_p.h deleted file mode 100644 index c038126..0000000 --- a/src/barchart/barlabel_p.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef BARLABEL_H -#define BARLABEL_H - -#include "chartitem_p.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class BarLabel : public ChartItem -{ -public: - BarLabel(QGraphicsItem* parent = 0); - - void set(QString label); - void setPos(qreal x, qreal y); - - // From ChartItem - void setSize(const QSizeF &size); - - // From QGraphicsItem - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - QRectF boundingRect() const; - -private: - - QSizeF mSize; - QString mLabel; - qreal mXpos; - qreal mYpos; - -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // BARLABEL_H diff --git a/src/barchart/barpresenter.cpp b/src/barchart/barpresenter.cpp index 41cd6af..ba74e40 100644 --- a/src/barchart/barpresenter.cpp +++ b/src/barchart/barpresenter.cpp @@ -39,8 +39,6 @@ void BarPresenter::layoutChanged() qreal xStepPerCategory = (tW/tC) + mBarWidth; int itemIndex(0); - int labelIndex(0); - for (int category=0; category < categoryCount; category++) { qreal xPos = xStepPerCategory * category; qreal yPos = mHeight; @@ -55,12 +53,6 @@ void BarPresenter::layoutChanged() itemIndex++; xPos += mBarWidth; } - - // TODO: Layout for labels, remove magic number - xPos = xStepPerCategory * category + mBarWidth/2; - BarLabel* label = mLabels.at(labelIndex); - label->setPos(xPos, mHeight - 20); - labelIndex++; } // Position floating values diff --git a/src/barchart/barpresenterbase.cpp b/src/barchart/barpresenterbase.cpp index b2103d7..bbe403a 100644 --- a/src/barchart/barpresenterbase.cpp +++ b/src/barchart/barpresenterbase.cpp @@ -55,7 +55,6 @@ void BarPresenterBase::dataChanged() } mBars.clear(); - mLabels.clear(); mSeparators.clear(); mFloatingValues.clear(); @@ -74,17 +73,6 @@ void BarPresenterBase::dataChanged() } } - // Create labels - /* - int count = mSeries->categoryCount(); - for (int i=0; iset(mSeries->categoryName(i)); - childItems().append(label); - mLabels.append(label); - } - */ - // Create separators int count = mSeries->categoryCount() - 1; // There is one less separator than columns for (int i=0; i mBars; - QList mLabels; QList mSeparators; QList mFloatingValues; QChart* mChart; diff --git a/src/barchart/percentbarpresenter.cpp b/src/barchart/percentbarpresenter.cpp index 57651bc..46fa5c1 100644 --- a/src/barchart/percentbarpresenter.cpp +++ b/src/barchart/percentbarpresenter.cpp @@ -39,7 +39,6 @@ void PercentBarPresenter::layoutChanged() qreal h = mHeight; int itemIndex(0); - int labelIndex(0); for (int category = 0; category < mSeries->categoryCount(); category++) { qreal colSum = mSeries->categorySum(category); qreal scale = (h / colSum); @@ -55,11 +54,6 @@ void PercentBarPresenter::layoutChanged() itemIndex++; yPos -= barHeight; } - - // TODO: Layout for labels, remove magic number - BarLabel* label = mLabels.at(labelIndex); - label->setPos(xPos, mHeight + 20); - labelIndex++; xPos += xStep; } diff --git a/src/barchart/stackedbarpresenter.cpp b/src/barchart/stackedbarpresenter.cpp index 7eabe61..3972c34 100644 --- a/src/barchart/stackedbarpresenter.cpp +++ b/src/barchart/stackedbarpresenter.cpp @@ -51,7 +51,6 @@ void StackedBarPresenter::layoutChanged() qreal xPos = ((tW/tC) - mBarWidth / 2); int itemIndex(0); - int labelIndex(0); for (int category = 0; category < mSeries->categoryCount(); category++) { qreal yPos = h; for (int set=0; set < mSeries->barsetCount(); set++) { @@ -64,11 +63,6 @@ void StackedBarPresenter::layoutChanged() itemIndex++; yPos -= barHeight; } - - // TODO: Layout for labels, remove magic number -// BarLabel* label = mLabels.at(labelIndex); -// label->setPos(xPos, mHeight + 20); - labelIndex++; xPos += xStep; }