diff --git a/examples/tablemodelchart/tablewidget.cpp b/examples/tablemodelchart/tablewidget.cpp index bb76676..3f893b7 100644 --- a/examples/tablemodelchart/tablewidget.cpp +++ b/examples/tablemodelchart/tablewidget.cpp @@ -64,6 +64,7 @@ TableWidget::TableWidget(QWidget *parent) QPushButton* removeRowButton = new QPushButton("Remove row"); connect(removeRowButton, SIGNAL(clicked()), this, SLOT(removeRow())); + // spin box for setting number of affected items (add, remove) m_linesCountSpinBox = new QSpinBox; m_linesCountSpinBox->setRange(1, 10); m_linesCountSpinBox->setValue(1); diff --git a/src/barchart/qbarseries.cpp b/src/barchart/qbarseries.cpp index bf164cb..d0c61e0 100644 --- a/src/barchart/qbarseries.cpp +++ b/src/barchart/qbarseries.cpp @@ -23,6 +23,7 @@ #include "qbarset.h" #include "barchartmodel_p.h" #include +#include QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -268,7 +269,7 @@ qreal QBarSeries::maxCategorySum() /*! \internal */ -BarChartModel& QBarSeries::model() +BarChartModel& QBarSeries::modelInternal() { return *m_internalModel; } diff --git a/src/barchart/qbarseries.h b/src/barchart/qbarseries.h index 6f67cce..3444b0c 100644 --- a/src/barchart/qbarseries.h +++ b/src/barchart/qbarseries.h @@ -24,6 +24,8 @@ #include #include +class QModelIndex; + QTCOMMERCIALCHART_BEGIN_NAMESPACE typedef QStringList QBarCategories; @@ -56,7 +58,7 @@ public: void setLabelsVisible(bool visible = true); bool setModel(QAbstractItemModel *model); - QAbstractItemModel *modelExt() { return m_model; } +// QAbstractItemModel *modelExt() { return m_model; } void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical); void setModelMappingShift(int first, int count); @@ -73,7 +75,7 @@ public: qreal categorySum(int category); qreal absoluteCategorySum(int category); qreal maxCategorySum(); - BarChartModel& model(); + BarChartModel& modelInternal(); // <--- TO PIMPL Q_SIGNALS: @@ -105,7 +107,7 @@ private Q_SLOTS: protected: BarChartModel *m_internalModel; // TODO: this may change... current "2 models" situation doesn't look good. - QAbstractItemModel* m_model; +// QAbstractItemModel* m_model; int m_mapCategories; int m_mapBarBottom; int m_mapBarTop; diff --git a/src/piechart/qpieseries.cpp b/src/piechart/qpieseries.cpp index 9554a7c..51f16ff 100644 --- a/src/piechart/qpieseries.cpp +++ b/src/piechart/qpieseries.cpp @@ -124,7 +124,6 @@ void QPieSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRigh if (m_mapOrientation == Qt::Vertical) { - // slices().at(topLeft.row())->setValue(m_model->data(m_model->index(topLeft.row(), topLeft.column()), Qt::DisplayRole).toDouble()); if (topLeft.column() == m_mapValues) if (m_mapValues == m_mapLabels) { @@ -140,7 +139,6 @@ void QPieSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRigh } else { - // slices().at(topLeft.column())->setValue(m_model->data(m_model->index(topLeft.row(), topLeft.column()), Qt::DisplayRole).toDouble()); if (topLeft.row() == m_mapValues) if (m_mapValues == m_mapLabels) { diff --git a/src/piechart/qpieseriesprivate_p.h b/src/piechart/qpieseriesprivate_p.h index 4a72600..67180b1 100644 --- a/src/piechart/qpieseriesprivate_p.h +++ b/src/piechart/qpieseriesprivate_p.h @@ -23,6 +23,8 @@ #include "qpieseries.h" +class QModelIndex; + QTCOMMERCIALCHART_BEGIN_NAMESPACE class QPieSeriesPrivate : public QObject diff --git a/src/qseries.h b/src/qseries.h index 073fb21..0d368ba 100644 --- a/src/qseries.h +++ b/src/qseries.h @@ -27,7 +27,6 @@ #include class QAbstractItemModel; -class QModelIndex; QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -54,6 +53,7 @@ public: virtual QSeriesType type() const = 0; // TODO virtual bool setModel(QAbstractItemModel* /*model*/) { return false; } + QAbstractItemModel* model() const { return m_model; } void setName(QString name) { m_name = name; } QString name() const { return m_name; } diff --git a/src/xychart/qxyseries.cpp b/src/xychart/qxyseries.cpp index 04c69f2..41d0b51 100644 --- a/src/xychart/qxyseries.cpp +++ b/src/xychart/qxyseries.cpp @@ -315,7 +315,9 @@ QXYSeries& QXYSeries::operator<< (const QList points) return *this; } - +/*! + \internal + */ void QXYSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) { Q_UNUSED(bottomRight) @@ -329,6 +331,9 @@ void QXYSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) } } +/*! + \internal + */ void QXYSeries::modelDataAboutToBeAdded(QModelIndex parent, int start, int end) { Q_UNUSED(parent) @@ -359,6 +364,9 @@ void QXYSeries::modelDataAboutToBeAdded(QModelIndex parent, int start, int end) } } +/*! + \internal + */ void QXYSeries::modelDataAdded(QModelIndex parent, int start, int end) { Q_UNUSED(parent) @@ -386,6 +394,9 @@ void QXYSeries::modelDataAdded(QModelIndex parent, int start, int end) } } +/*! + \internal + */ void QXYSeries::modelDataAboutToBeRemoved(QModelIndex parent, int start, int end) { Q_UNUSED(parent) @@ -415,6 +426,9 @@ void QXYSeries::modelDataAboutToBeRemoved(QModelIndex parent, int start, int end } } +/*! + \internal + */ void QXYSeries::modelDataRemoved(QModelIndex parent, int start, int end) { Q_UNUSED(parent) @@ -450,6 +464,15 @@ void QXYSeries::modelDataRemoved(QModelIndex parent, int start, int end) } } +/*! + \fn QAbstractItemModel* QXYSeries::model() + Returns the model from which the series takes its data. + */ + +/*! + \fn bool QXYSeries::setModel(QAbstractItemModel *model) + Sets the \a model to be used as a data source + */ bool QXYSeries::setModel(QAbstractItemModel *model) { // disconnect signals from old model diff --git a/src/xychart/qxyseries.h b/src/xychart/qxyseries.h index c114242..1bce264 100644 --- a/src/xychart/qxyseries.h +++ b/src/xychart/qxyseries.h @@ -26,6 +26,8 @@ #include #include +class QModelIndex; + QTCOMMERCIALCHART_BEGIN_NAMESPACE class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries @@ -60,7 +62,7 @@ public: QBrush brush() const {return m_brush;} bool setModel(QAbstractItemModel *model); - QAbstractItemModel* model() const { return m_model; } +// QAbstractItemModel* model() const { return m_model; } virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); virtual void setModelMappingRange(int first, int count = 0);