diff --git a/examples/modeldata/tablewidget.cpp b/examples/modeldata/tablewidget.cpp index 30727bc..cdcd5c9 100644 --- a/examples/modeldata/tablewidget.cpp +++ b/examples/modeldata/tablewidget.cpp @@ -38,8 +38,6 @@ TableWidget::TableWidget(QWidget *parent) // create table view and add model to it QTableView *tableView = new QTableView; tableView->setModel(model); -// tableView-> -// tableView->setMinimumWidth(200); tableView->setColumnWidth(0, 56); tableView->setColumnWidth(1, 56); tableView->setColumnWidth(2, 56); diff --git a/src/barchart/qbarseries.cpp b/src/barchart/qbarseries.cpp index 0a39fee..7983fc4 100644 --- a/src/barchart/qbarseries.cpp +++ b/src/barchart/qbarseries.cpp @@ -305,7 +305,14 @@ bool QBarSeries::setModel(QAbstractItemModel *model) } } -// TODO +/*! + \fn bool QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation) + Sets column/row specified by \a categories to be used as a list of bar series categories. + Parameter \a bottomBoundry indicates the column/row where the first bar set is located in the model. + Parameter \a topBoundry indicates the column/row where the last bar set is located in the model. + All the columns/rows inbetween those two values are also used as data for bar sets. + The \a orientation paramater specifies whether the data is in columns or in rows. + */ void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation) { if (!m_model) @@ -336,7 +343,6 @@ void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBound this, SLOT(modelDataRemoved(QModelIndex,int,int))); } - // create the initial bars delete m_internalModel; if (m_mapOrientation == Qt::Vertical) { @@ -366,12 +372,9 @@ void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBound } } -void QBarSeries::setModelMappingShift(int first, int count) -{ - m_mapFirst = first; - m_mapCount = count; -} - +/*! + \internal +*/ void QBarSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) { Q_UNUSED(bottomRight) @@ -390,6 +393,9 @@ void QBarSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) } } +/*! + \internal +*/ void QBarSeries::modelDataAdded(QModelIndex /*parent*/, int start, int /*end*/) { if (m_mapOrientation == Qt::Vertical) { @@ -406,6 +412,9 @@ void QBarSeries::modelDataAdded(QModelIndex /*parent*/, int start, int /*end*/) emit restructuredBars(); } +/*! + \internal +*/ void QBarSeries::modelDataRemoved(QModelIndex parent, int start, int end) { Q_UNUSED(parent) diff --git a/src/barchart/qbarseries.h b/src/barchart/qbarseries.h index 9428738..d2b7fe3 100644 --- a/src/barchart/qbarseries.h +++ b/src/barchart/qbarseries.h @@ -58,8 +58,7 @@ public: void setLabelsVisible(bool visible = true); bool setModel(QAbstractItemModel *model); - void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical); - void setModelMappingShift(int first, int count); + void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical); public: // TODO: Functions below this are not part of api and will be moved diff --git a/src/piechart/qpieseries.cpp b/src/piechart/qpieseries.cpp index 6fa244a..13a3c42 100644 --- a/src/piechart/qpieseries.cpp +++ b/src/piechart/qpieseries.cpp @@ -668,6 +668,13 @@ bool QPieSeries::setModel(QAbstractItemModel* model) } } +/*! + \fn bool QPieSeries::setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::Orientation orientation) + Sets column/row specified by \a modelValuesLine to be used as a list of pie slice values for the pie. + Parameter \a modelValuesLine indicates the column/row where the values for the pie slices are located in the model. + Parameter \a modelLabelsLine indicates the column/row where the labels for the pie slices are located in the model. + The \a orientation paramater specifies whether the data is in columns or in rows. + */ void QPieSeries::setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::Orientation orientation) { Q_D(QPieSeries); diff --git a/src/splinechart/qsplineseries.cpp b/src/splinechart/qsplineseries.cpp index 3e4f834..e080413 100644 --- a/src/splinechart/qsplineseries.cpp +++ b/src/splinechart/qsplineseries.cpp @@ -155,19 +155,38 @@ void QSplineSeries::updateControlPoints() } } -bool QSplineSeries::setModel(QAbstractItemModel* model) -{ - QXYSeries::setModel(model); -// calculateControlPoints(); - return true; -} +/*! + \fn bool QSplineSeries::setModel(QAbstractItemModel *model) + Sets the \a model to be used as a data source + \sa setModelMapping(), setModelMappingRange() + */ +//bool QSplineSeries::setModel(QAbstractItemModel* model) +//{ +// QXYSeries::setModel(model); +//// calculateControlPoints(); +// return true; +//} -void QSplineSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation) -{ - QLineSeries::setModelMapping(modelX, modelY, orientation); -// calculateControlPoints(); -} +/*! + \fn bool QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation) + Sets the \a modelX to be used as a data source for x coordinate and \a modelY to be used + as a data source for y coordinate. The \a orientation paramater specifies whether the data + is in columns or in rows. + */ +//void QSplineSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation) +//{ +// QLineSeries::setModelMapping(modelX, modelY, orientation); +//// calculateControlPoints(); +//} +/*! + \fn bool QSplineSeries::setModelMappingRange(int first, int count) + Allows limiting the model mapping. + Parameter \a first specifies which element of the model should be used as a first one of the series. + Parameter \a count specifies how many elements should be mapped. If count is not specified (defaults to -1) + then all the items following \a first item in a model are used. + \sa setModel(), setModelMapping() + */ void QSplineSeries::setModelMappingRange(int first, int count) { QLineSeries::setModelMappingRange(first, count); diff --git a/src/splinechart/qsplineseries.h b/src/splinechart/qsplineseries.h index fc9695d..cd07175 100644 --- a/src/splinechart/qsplineseries.h +++ b/src/splinechart/qsplineseries.h @@ -38,9 +38,9 @@ public: QSeriesType type() const {return QSeries::SeriesTypeSpline;} QPointF controlPoint(int index) const {return m_controlPoints[index];} - bool setModel(QAbstractItemModel *model); +// bool setModel(QAbstractItemModel *model); - void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); +// void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); void setModelMappingRange(int first, int count); private: diff --git a/src/xychart/qxyseries.cpp b/src/xychart/qxyseries.cpp index 41d0b51..b2fe8e2 100644 --- a/src/xychart/qxyseries.cpp +++ b/src/xychart/qxyseries.cpp @@ -66,6 +66,19 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! + \fn int QXYSeries::mapFirst() const + Returns the index of the model's item that is used as a first one for the series. + \sa mapCount() +*/ + +/*! + \fn int QXYSeries::mapCount() const + Returns the number of the items that are taken from the model. + If -1 it means all the items of the model following the first one are used. + \sa mapFirst() +*/ + +/*! Constructs empty series object which is a child of \a parent. When series object is added to QChartView or QChart instance ownerships is transfered. */ @@ -472,6 +485,7 @@ void QXYSeries::modelDataRemoved(QModelIndex parent, int start, int end) /*! \fn bool QXYSeries::setModel(QAbstractItemModel *model) Sets the \a model to be used as a data source + \sa setModelMapping(), setModelMappingRange() */ bool QXYSeries::setModel(QAbstractItemModel *model) { @@ -496,6 +510,13 @@ bool QXYSeries::setModel(QAbstractItemModel *model) { } } +/*! + \fn bool QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation) + Sets the \a modelX to be used as a data source for x coordinate and \a modelY to be used + as a data source for y coordinate. The \a orientation paramater specifies whether the data + is in columns or in rows. + \sa setModel(), setModelMappingRange() + */ void QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation) { if (m_model == 0) @@ -519,6 +540,14 @@ void QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientat } } +/*! + \fn bool QXYSeries::setModelMappingRange(int first, int count) + Allows limiting the model mapping. + Parameter \a first specifies which element of the model should be used as a first one of the series. + Parameter \a count specifies how many elements should be mapped. If count is not specified (defaults to -1) + then all the items following \a first item in a model are used. + \sa setModel(), setModelMapping() + */ void QXYSeries::setModelMappingRange(int first, int count) { m_mapFirst = first; diff --git a/src/xychart/qxyseries.h b/src/xychart/qxyseries.h index e802790..0c7862f 100644 --- a/src/xychart/qxyseries.h +++ b/src/xychart/qxyseries.h @@ -66,6 +66,7 @@ public: virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); virtual void setModelMappingRange(int first, int count = 0); int mapFirst() const { return m_mapFirst; } + int mapCount() const { return m_mapCount; } private Q_SLOTS: void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);