From c52c8b56cc6c916f695cd444500ed06436c92172 2012-03-19 14:55:19 From: sauimone Date: 2012-03-19 14:55:19 Subject: [PATCH] cleanup on barseries. removed old commented out separator code --- diff --git a/examples/barchart/main.cpp b/examples/barchart/main.cpp index 0fe5f4f..01d887f 100644 --- a/examples/barchart/main.cpp +++ b/examples/barchart/main.cpp @@ -49,7 +49,6 @@ int main(int argc, char *argv[]) //! [4] // Enable tooltip series->setToolTipEnabled(); - series->setSeparatorsVisible(true); // Connect clicked signal of set to toggle floating values of set. QObject::connect(set0,SIGNAL(clicked(QString)),set0,SIGNAL(toggleFloatingValues())); diff --git a/src/barchart/barchart.pri b/src/barchart/barchart.pri index bf59961..7216025 100644 --- a/src/barchart/barchart.pri +++ b/src/barchart/barchart.pri @@ -11,7 +11,6 @@ SOURCES += \ $$PWD/qbarset.cpp \ $$PWD/qpercentbarseries.cpp \ $$PWD/qstackedbarseries.cpp \ - $$PWD/separator.cpp \ $$PWD/stackedbarpresenter.cpp \ $$PWD/barvalue.cpp @@ -21,7 +20,6 @@ PRIVATE_HEADERS += \ $$PWD/barpresenter_p.h \ $$PWD/barpresenterbase_p.h \ $$PWD/percentbarpresenter_p.h \ - $$PWD/separator_p.h \ $$PWD/stackedbarpresenter_p.h \ $$PWD/barvalue_p.h diff --git a/src/barchart/barpresenter.cpp b/src/barchart/barpresenter.cpp index 8fc0c36..83018bb 100644 --- a/src/barchart/barpresenter.cpp +++ b/src/barchart/barpresenter.cpp @@ -1,7 +1,6 @@ #include "barpresenter_p.h" #include "bar_p.h" #include "barvalue_p.h" -#include "separator_p.h" #include "qbarset.h" #include @@ -54,17 +53,7 @@ void BarPresenter::layoutChanged() xPos += mBarWidth; } } -/* - // Position separators - qreal xPos = categoryWidth + categoryWidth/2; - for (int s=0; s < mSeparators.count(); s++) { - Separator* sep = mSeparators.at(s); - sep->setPos(xPos,0); - sep->setSize(QSizeF(1,mHeight)); - sep->setColor(QColor(255,0,0,255)); // TODO: color for separations from theme - xPos += categoryWidth; - } -*/ + // Position floating values itemIndex = 0; for (int category=0; category < mSeries->categoryCount(); category++) { diff --git a/src/barchart/barpresenterbase.cpp b/src/barchart/barpresenterbase.cpp index 56e097a..7d58909 100644 --- a/src/barchart/barpresenterbase.cpp +++ b/src/barchart/barpresenterbase.cpp @@ -1,7 +1,6 @@ #include "barpresenterbase_p.h" #include "bar_p.h" #include "barvalue_p.h" -#include "separator_p.h" #include "qbarset.h" #include "qbarseries.h" #include "qchart.h" @@ -22,8 +21,6 @@ BarPresenterBase::BarPresenterBase(QBarSeries *series, QChart *parent) : mChart(parent) { connect(series,SIGNAL(showToolTip(QPoint,QString)),this,SLOT(showToolTip(QPoint,QString))); -// connect(series,SIGNAL(enableSeparators(bool)),this,SLOT(enableSeparators(bool))); -// enableSeparators(series->separatorsVisible()); setZValue(ChartPresenter::BarSeriesZValue); initAxisLabels(); dataChanged(); @@ -32,7 +29,6 @@ BarPresenterBase::BarPresenterBase(QBarSeries *series, QChart *parent) : BarPresenterBase::~BarPresenterBase() { disconnect(this,SLOT(showToolTip(QPoint,QString))); -// disconnect(this,SLOT(enableSeparators(bool))); } void BarPresenterBase::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) @@ -60,7 +56,6 @@ void BarPresenterBase::dataChanged() } mBars.clear(); -// mSeparators.clear(); mFloatingValues.clear(); // Create new graphic items for bars @@ -77,16 +72,7 @@ void BarPresenterBase::dataChanged() connect(bar,SIGNAL(hoverLeaved()),set,SLOT(barHoverLeaveEvent())); } } -/* - // Create separators - int count = mSeries->categoryCount() - 1; // There is one less separator than columns - for (int i=0; isetVisible(mSeries->separatorsVisible()); - childItems().append(sep); - mSeparators.append(sep); - } -*/ + // Create floating values for (int category=0; categorycategoryCount(); category++) { for (int s=0; sbarsetCount(); s++) { @@ -175,15 +161,6 @@ void BarPresenterBase::showToolTip(QPoint pos, QString tip) QToolTip::showText(pos,tip); } -/* -void BarPresenterBase::enableSeparators(bool enabled) -{ - for (int i=0; isetVisible(enabled); - } -} -*/ - #include "moc_barpresenterbase_p.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/barpresenterbase_p.h b/src/barchart/barpresenterbase_p.h index 5cb1c82..636916f 100644 --- a/src/barchart/barpresenterbase_p.h +++ b/src/barchart/barpresenterbase_p.h @@ -10,7 +10,6 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE class Bar; -class Separator; class BarValue; class QChartAxisCategories; class QChart; @@ -43,7 +42,6 @@ public slots: // Internal slots void showToolTip(QPoint pos, QString tip); // shows tooltip (if enabled) -// void enableSeparators(bool enabled); protected: @@ -57,7 +55,6 @@ protected: // Not owned. QBarSeries* mSeries; QList mBars; -// QList mSeparators; QList mFloatingValues; QChart* mChart; }; diff --git a/src/barchart/percentbarpresenter.cpp b/src/barchart/percentbarpresenter.cpp index 1abb9d1..d55f986 100644 --- a/src/barchart/percentbarpresenter.cpp +++ b/src/barchart/percentbarpresenter.cpp @@ -1,7 +1,6 @@ #include "percentbarpresenter_p.h" #include "bar_p.h" #include "barvalue_p.h" -#include "separator_p.h" #include "qbarset.h" #include @@ -56,16 +55,7 @@ void PercentBarPresenter::layoutChanged() } xPos += xStep; } -/* - // Position separators - xPos = xStep + xStep/2; - for (int s=0; s < mSeries->categoryCount() - 1; s++) { - Separator* sep = mSeparators.at(s); - sep->setPos(xPos,0); - sep->setSize(QSizeF(1,mHeight)); - xPos += xStep; - } -*/ + // Position floating values itemIndex = 0; xPos = (tW/tC); diff --git a/src/barchart/qbarseries.cpp b/src/barchart/qbarseries.cpp index 9e05f51..94d054d 100644 --- a/src/barchart/qbarseries.cpp +++ b/src/barchart/qbarseries.cpp @@ -133,17 +133,6 @@ void QBarSeries::setToolTipEnabled(bool enabled) } } -/*! - Enables or disables separators depending on parameter \a enabled. - Separators are visual elements that are drawn between categories. - Calling without parameter \a enabled, enables the separators -*/ -void QBarSeries::setSeparatorsVisible(bool visible) -{ - mSeparatorsVisible = visible; - emit enableSeparators(visible); -} - /*! \internal \a category @@ -218,11 +207,6 @@ BarChartModel& QBarSeries::model() return *mModel; } -bool QBarSeries::separatorsVisible() -{ - return mSeparatorsVisible; -} - bool QBarSeries::setModel(QAbstractItemModel* model) { // disconnect signals from old model diff --git a/src/barchart/qbarseries.h b/src/barchart/qbarseries.h index 782a552..7d321cb 100644 --- a/src/barchart/qbarseries.h +++ b/src/barchart/qbarseries.h @@ -42,7 +42,6 @@ public: qreal categorySum(int category); qreal maxCategorySum(); BarChartModel& model(); - bool separatorsVisible(); // <--- TO PIMPL signals: @@ -52,13 +51,11 @@ signals: // TODO: internal signals, these to private implementation. // TODO: TO PIMPL ---> - void enableSeparators(bool enable); void showToolTip(QPoint pos, QString tip); // <--- TO PIMPL public Q_SLOTS: void setToolTipEnabled(bool enabled=true); // enables tooltips - void setSeparatorsVisible(bool visible=true); // enables separators between categories // TODO: TO PIMPL ---> void barsetClicked(QString category); @@ -74,7 +71,6 @@ private Q_SLOTS: protected: BarChartModel* mModel; - bool mSeparatorsVisible; QAbstractItemModel* m_model; int m_mapCategories; diff --git a/src/barchart/stackedbarpresenter.cpp b/src/barchart/stackedbarpresenter.cpp index d2aae63..47f99b0 100644 --- a/src/barchart/stackedbarpresenter.cpp +++ b/src/barchart/stackedbarpresenter.cpp @@ -1,7 +1,6 @@ #include "stackedbarpresenter_p.h" #include "bar_p.h" #include "barvalue_p.h" -#include "separator_p.h" #include "qbarset.h" #include @@ -64,16 +63,7 @@ void StackedBarPresenter::layoutChanged() } xPos += xStep; } -/* - // Position separators - xPos = xStep + xStep/2; - for (int s=0; s < mSeries->categoryCount() - 1; s++) { - Separator* sep = mSeparators.at(s); - sep->setPos(xPos,0); - sep->setSize(QSizeF(1,mHeight)); - xPos += xStep; - } -*/ + // Position floating values itemIndex = 0; xPos = (tW/tC); diff --git a/test/chartwidgettest/mainwidget.cpp b/test/chartwidgettest/mainwidget.cpp index cbeff81..3162229 100644 --- a/test/chartwidgettest/mainwidget.cpp +++ b/test/chartwidgettest/mainwidget.cpp @@ -268,7 +268,6 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS // TODO: new implementation of setFloatingValuesEnabled with signals //series->setFloatingValuesEnabled(true); series->setToolTipEnabled(true); - series->setSeparatorsVisible(false); m_chartView->addSeries(series); } else if (seriesName == "Spline") { for (int j(0); j < data.count(); j ++) {