##// END OF EJS Templates
Added documentation for model related funtions
Marek Rosa -
r900:4e59f6549e80
parent child
Show More
@@ -38,8 +38,6 TableWidget::TableWidget(QWidget *parent)
38 // create table view and add model to it
38 // create table view and add model to it
39 QTableView *tableView = new QTableView;
39 QTableView *tableView = new QTableView;
40 tableView->setModel(model);
40 tableView->setModel(model);
41 // tableView->
42 // tableView->setMinimumWidth(200);
43 tableView->setColumnWidth(0, 56);
41 tableView->setColumnWidth(0, 56);
44 tableView->setColumnWidth(1, 56);
42 tableView->setColumnWidth(1, 56);
45 tableView->setColumnWidth(2, 56);
43 tableView->setColumnWidth(2, 56);
@@ -305,7 +305,14 bool QBarSeries::setModel(QAbstractItemModel *model)
305 }
305 }
306 }
306 }
307
307
308 // TODO
308 /*!
309 \fn bool QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation)
310 Sets column/row specified by \a categories to be used as a list of bar series categories.
311 Parameter \a bottomBoundry indicates the column/row where the first bar set is located in the model.
312 Parameter \a topBoundry indicates the column/row where the last bar set is located in the model.
313 All the columns/rows inbetween those two values are also used as data for bar sets.
314 The \a orientation paramater specifies whether the data is in columns or in rows.
315 */
309 void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation)
316 void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation)
310 {
317 {
311 if (!m_model)
318 if (!m_model)
@@ -336,7 +343,6 void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBound
336 this, SLOT(modelDataRemoved(QModelIndex,int,int)));
343 this, SLOT(modelDataRemoved(QModelIndex,int,int)));
337 }
344 }
338
345
339
340 // create the initial bars
346 // create the initial bars
341 delete m_internalModel;
347 delete m_internalModel;
342 if (m_mapOrientation == Qt::Vertical) {
348 if (m_mapOrientation == Qt::Vertical) {
@@ -366,12 +372,9 void QBarSeries::setModelMapping(int categories, int bottomBoundry, int topBound
366 }
372 }
367 }
373 }
368
374
369 void QBarSeries::setModelMappingShift(int first, int count)
375 /*!
370 {
376 \internal
371 m_mapFirst = first;
377 */
372 m_mapCount = count;
373 }
374
375 void QBarSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
378 void QBarSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
376 {
379 {
377 Q_UNUSED(bottomRight)
380 Q_UNUSED(bottomRight)
@@ -390,6 +393,9 void QBarSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
390 }
393 }
391 }
394 }
392
395
396 /*!
397 \internal
398 */
393 void QBarSeries::modelDataAdded(QModelIndex /*parent*/, int start, int /*end*/)
399 void QBarSeries::modelDataAdded(QModelIndex /*parent*/, int start, int /*end*/)
394 {
400 {
395 if (m_mapOrientation == Qt::Vertical) {
401 if (m_mapOrientation == Qt::Vertical) {
@@ -406,6 +412,9 void QBarSeries::modelDataAdded(QModelIndex /*parent*/, int start, int /*end*/)
406 emit restructuredBars();
412 emit restructuredBars();
407 }
413 }
408
414
415 /*!
416 \internal
417 */
409 void QBarSeries::modelDataRemoved(QModelIndex parent, int start, int end)
418 void QBarSeries::modelDataRemoved(QModelIndex parent, int start, int end)
410 {
419 {
411 Q_UNUSED(parent)
420 Q_UNUSED(parent)
@@ -58,8 +58,7 public:
58 void setLabelsVisible(bool visible = true);
58 void setLabelsVisible(bool visible = true);
59
59
60 bool setModel(QAbstractItemModel *model);
60 bool setModel(QAbstractItemModel *model);
61 void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical);
61 void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical);
62 void setModelMappingShift(int first, int count);
63
62
64 public:
63 public:
65 // TODO: Functions below this are not part of api and will be moved
64 // TODO: Functions below this are not part of api and will be moved
@@ -668,6 +668,13 bool QPieSeries::setModel(QAbstractItemModel* model)
668 }
668 }
669 }
669 }
670
670
671 /*!
672 \fn bool QPieSeries::setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::Orientation orientation)
673 Sets column/row specified by \a modelValuesLine to be used as a list of pie slice values for the pie.
674 Parameter \a modelValuesLine indicates the column/row where the values for the pie slices are located in the model.
675 Parameter \a modelLabelsLine indicates the column/row where the labels for the pie slices are located in the model.
676 The \a orientation paramater specifies whether the data is in columns or in rows.
677 */
671 void QPieSeries::setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::Orientation orientation)
678 void QPieSeries::setModelMapping(int modelValuesLine, int modelLabelsLine, Qt::Orientation orientation)
672 {
679 {
673 Q_D(QPieSeries);
680 Q_D(QPieSeries);
@@ -155,19 +155,38 void QSplineSeries::updateControlPoints()
155 }
155 }
156 }
156 }
157
157
158 bool QSplineSeries::setModel(QAbstractItemModel* model)
158 /*!
159 {
159 \fn bool QSplineSeries::setModel(QAbstractItemModel *model)
160 QXYSeries::setModel(model);
160 Sets the \a model to be used as a data source
161 // calculateControlPoints();
161 \sa setModelMapping(), setModelMappingRange()
162 return true;
162 */
163 }
163 //bool QSplineSeries::setModel(QAbstractItemModel* model)
164 //{
165 // QXYSeries::setModel(model);
166 //// calculateControlPoints();
167 // return true;
168 //}
164
169
165 void QSplineSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation)
170 /*!
166 {
171 \fn bool QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation)
167 QLineSeries::setModelMapping(modelX, modelY, orientation);
172 Sets the \a modelX to be used as a data source for x coordinate and \a modelY to be used
168 // calculateControlPoints();
173 as a data source for y coordinate. The \a orientation paramater specifies whether the data
169 }
174 is in columns or in rows.
175 */
176 //void QSplineSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation)
177 //{
178 // QLineSeries::setModelMapping(modelX, modelY, orientation);
179 //// calculateControlPoints();
180 //}
170
181
182 /*!
183 \fn bool QSplineSeries::setModelMappingRange(int first, int count)
184 Allows limiting the model mapping.
185 Parameter \a first specifies which element of the model should be used as a first one of the series.
186 Parameter \a count specifies how many elements should be mapped. If count is not specified (defaults to -1)
187 then all the items following \a first item in a model are used.
188 \sa setModel(), setModelMapping()
189 */
171 void QSplineSeries::setModelMappingRange(int first, int count)
190 void QSplineSeries::setModelMappingRange(int first, int count)
172 {
191 {
173 QLineSeries::setModelMappingRange(first, count);
192 QLineSeries::setModelMappingRange(first, count);
@@ -38,9 +38,9 public:
38 QSeriesType type() const {return QSeries::SeriesTypeSpline;}
38 QSeriesType type() const {return QSeries::SeriesTypeSpline;}
39
39
40 QPointF controlPoint(int index) const {return m_controlPoints[index];}
40 QPointF controlPoint(int index) const {return m_controlPoints[index];}
41 bool setModel(QAbstractItemModel *model);
41 // bool setModel(QAbstractItemModel *model);
42
42
43 void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
43 // void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
44 void setModelMappingRange(int first, int count);
44 void setModelMappingRange(int first, int count);
45
45
46 private:
46 private:
@@ -66,6 +66,19 QTCOMMERCIALCHART_BEGIN_NAMESPACE
66 */
66 */
67
67
68 /*!
68 /*!
69 \fn int QXYSeries::mapFirst() const
70 Returns the index of the model's item that is used as a first one for the series.
71 \sa mapCount()
72 */
73
74 /*!
75 \fn int QXYSeries::mapCount() const
76 Returns the number of the items that are taken from the model.
77 If -1 it means all the items of the model following the first one are used.
78 \sa mapFirst()
79 */
80
81 /*!
69 Constructs empty series object which is a child of \a parent.
82 Constructs empty series object which is a child of \a parent.
70 When series object is added to QChartView or QChart instance ownerships is transfered.
83 When series object is added to QChartView or QChart instance ownerships is transfered.
71 */
84 */
@@ -472,6 +485,7 void QXYSeries::modelDataRemoved(QModelIndex parent, int start, int end)
472 /*!
485 /*!
473 \fn bool QXYSeries::setModel(QAbstractItemModel *model)
486 \fn bool QXYSeries::setModel(QAbstractItemModel *model)
474 Sets the \a model to be used as a data source
487 Sets the \a model to be used as a data source
488 \sa setModelMapping(), setModelMappingRange()
475 */
489 */
476 bool QXYSeries::setModel(QAbstractItemModel *model) {
490 bool QXYSeries::setModel(QAbstractItemModel *model) {
477
491
@@ -496,6 +510,13 bool QXYSeries::setModel(QAbstractItemModel *model) {
496 }
510 }
497 }
511 }
498
512
513 /*!
514 \fn bool QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation)
515 Sets the \a modelX to be used as a data source for x coordinate and \a modelY to be used
516 as a data source for y coordinate. The \a orientation paramater specifies whether the data
517 is in columns or in rows.
518 \sa setModel(), setModelMappingRange()
519 */
499 void QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation)
520 void QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation)
500 {
521 {
501 if (m_model == 0)
522 if (m_model == 0)
@@ -519,6 +540,14 void QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientat
519 }
540 }
520 }
541 }
521
542
543 /*!
544 \fn bool QXYSeries::setModelMappingRange(int first, int count)
545 Allows limiting the model mapping.
546 Parameter \a first specifies which element of the model should be used as a first one of the series.
547 Parameter \a count specifies how many elements should be mapped. If count is not specified (defaults to -1)
548 then all the items following \a first item in a model are used.
549 \sa setModel(), setModelMapping()
550 */
522 void QXYSeries::setModelMappingRange(int first, int count)
551 void QXYSeries::setModelMappingRange(int first, int count)
523 {
552 {
524 m_mapFirst = first;
553 m_mapFirst = first;
@@ -66,6 +66,7 public:
66 virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
66 virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical);
67 virtual void setModelMappingRange(int first, int count = 0);
67 virtual void setModelMappingRange(int first, int count = 0);
68 int mapFirst() const { return m_mapFirst; }
68 int mapFirst() const { return m_mapFirst; }
69 int mapCount() const { return m_mapCount; }
69
70
70 private Q_SLOTS:
71 private Q_SLOTS:
71 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
72 void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
General Comments 0
You need to be logged in to leave comments. Login now