@@ -64,6 +64,7 TableWidget::TableWidget(QWidget *parent) | |||||
64 | QPushButton* removeRowButton = new QPushButton("Remove row"); |
|
64 | QPushButton* removeRowButton = new QPushButton("Remove row"); | |
65 | connect(removeRowButton, SIGNAL(clicked()), this, SLOT(removeRow())); |
|
65 | connect(removeRowButton, SIGNAL(clicked()), this, SLOT(removeRow())); | |
66 |
|
66 | |||
|
67 | // spin box for setting number of affected items (add, remove) | |||
67 | m_linesCountSpinBox = new QSpinBox; |
|
68 | m_linesCountSpinBox = new QSpinBox; | |
68 | m_linesCountSpinBox->setRange(1, 10); |
|
69 | m_linesCountSpinBox->setRange(1, 10); | |
69 | m_linesCountSpinBox->setValue(1); |
|
70 | m_linesCountSpinBox->setValue(1); |
@@ -23,6 +23,7 | |||||
23 | #include "qbarset.h" |
|
23 | #include "qbarset.h" | |
24 | #include "barchartmodel_p.h" |
|
24 | #include "barchartmodel_p.h" | |
25 | #include <QAbstractItemModel> |
|
25 | #include <QAbstractItemModel> | |
|
26 | #include <QModelIndex> | |||
26 |
|
27 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
29 | |||
@@ -268,7 +269,7 qreal QBarSeries::maxCategorySum() | |||||
268 | /*! |
|
269 | /*! | |
269 | \internal |
|
270 | \internal | |
270 | */ |
|
271 | */ | |
271 | BarChartModel& QBarSeries::model() |
|
272 | BarChartModel& QBarSeries::modelInternal() | |
272 | { |
|
273 | { | |
273 | return *m_internalModel; |
|
274 | return *m_internalModel; | |
274 | } |
|
275 | } |
@@ -24,6 +24,8 | |||||
24 | #include <qseries.h> |
|
24 | #include <qseries.h> | |
25 | #include <QStringList> |
|
25 | #include <QStringList> | |
26 |
|
26 | |||
|
27 | class QModelIndex; | |||
|
28 | ||||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
30 | |||
29 | typedef QStringList QBarCategories; |
|
31 | typedef QStringList QBarCategories; | |
@@ -56,7 +58,7 public: | |||||
56 | void setLabelsVisible(bool visible = true); |
|
58 | void setLabelsVisible(bool visible = true); | |
57 |
|
59 | |||
58 | bool setModel(QAbstractItemModel *model); |
|
60 | bool setModel(QAbstractItemModel *model); | |
59 | QAbstractItemModel *modelExt() { return m_model; } |
|
61 | // QAbstractItemModel *modelExt() { return m_model; } | |
60 | void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical); |
|
62 | void setModelMapping(int categories, int bottomBoundry, int topBoundry, Qt::Orientation orientation = Qt::Vertical); | |
61 | void setModelMappingShift(int first, int count); |
|
63 | void setModelMappingShift(int first, int count); | |
62 |
|
64 | |||
@@ -73,7 +75,7 public: | |||||
73 | qreal categorySum(int category); |
|
75 | qreal categorySum(int category); | |
74 | qreal absoluteCategorySum(int category); |
|
76 | qreal absoluteCategorySum(int category); | |
75 | qreal maxCategorySum(); |
|
77 | qreal maxCategorySum(); | |
76 | BarChartModel& model(); |
|
78 | BarChartModel& modelInternal(); | |
77 | // <--- TO PIMPL |
|
79 | // <--- TO PIMPL | |
78 |
|
80 | |||
79 | Q_SIGNALS: |
|
81 | Q_SIGNALS: | |
@@ -105,7 +107,7 private Q_SLOTS: | |||||
105 | protected: |
|
107 | protected: | |
106 | BarChartModel *m_internalModel; // TODO: this may change... current "2 models" situation doesn't look good. |
|
108 | BarChartModel *m_internalModel; // TODO: this may change... current "2 models" situation doesn't look good. | |
107 |
|
109 | |||
108 | QAbstractItemModel* m_model; |
|
110 | // QAbstractItemModel* m_model; | |
109 | int m_mapCategories; |
|
111 | int m_mapCategories; | |
110 | int m_mapBarBottom; |
|
112 | int m_mapBarBottom; | |
111 | int m_mapBarTop; |
|
113 | int m_mapBarTop; |
@@ -124,7 +124,6 void QPieSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRigh | |||||
124 |
|
124 | |||
125 | if (m_mapOrientation == Qt::Vertical) |
|
125 | if (m_mapOrientation == Qt::Vertical) | |
126 | { |
|
126 | { | |
127 | // slices().at(topLeft.row())->setValue(m_model->data(m_model->index(topLeft.row(), topLeft.column()), Qt::DisplayRole).toDouble()); |
|
|||
128 | if (topLeft.column() == m_mapValues) |
|
127 | if (topLeft.column() == m_mapValues) | |
129 | if (m_mapValues == m_mapLabels) |
|
128 | if (m_mapValues == m_mapLabels) | |
130 | { |
|
129 | { | |
@@ -140,7 +139,6 void QPieSeriesPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRigh | |||||
140 | } |
|
139 | } | |
141 | else |
|
140 | else | |
142 | { |
|
141 | { | |
143 | // slices().at(topLeft.column())->setValue(m_model->data(m_model->index(topLeft.row(), topLeft.column()), Qt::DisplayRole).toDouble()); |
|
|||
144 | if (topLeft.row() == m_mapValues) |
|
142 | if (topLeft.row() == m_mapValues) | |
145 | if (m_mapValues == m_mapLabels) |
|
143 | if (m_mapValues == m_mapLabels) | |
146 | { |
|
144 | { |
@@ -23,6 +23,8 | |||||
23 |
|
23 | |||
24 | #include "qpieseries.h" |
|
24 | #include "qpieseries.h" | |
25 |
|
25 | |||
|
26 | class QModelIndex; | |||
|
27 | ||||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
29 | |||
28 | class QPieSeriesPrivate : public QObject |
|
30 | class QPieSeriesPrivate : public QObject |
@@ -27,7 +27,6 | |||||
27 | #include <QPen> |
|
27 | #include <QPen> | |
28 |
|
28 | |||
29 | class QAbstractItemModel; |
|
29 | class QAbstractItemModel; | |
30 | class QModelIndex; |
|
|||
31 |
|
30 | |||
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
33 |
|
32 | |||
@@ -54,6 +53,7 public: | |||||
54 | virtual QSeriesType type() const = 0; |
|
53 | virtual QSeriesType type() const = 0; | |
55 | // TODO |
|
54 | // TODO | |
56 | virtual bool setModel(QAbstractItemModel* /*model*/) { return false; } |
|
55 | virtual bool setModel(QAbstractItemModel* /*model*/) { return false; } | |
|
56 | QAbstractItemModel* model() const { return m_model; } | |||
57 | void setName(QString name) { m_name = name; } |
|
57 | void setName(QString name) { m_name = name; } | |
58 | QString name() const { return m_name; } |
|
58 | QString name() const { return m_name; } | |
59 |
|
59 |
@@ -315,7 +315,9 QXYSeries& QXYSeries::operator<< (const QList<QPointF> points) | |||||
315 | return *this; |
|
315 | return *this; | |
316 | } |
|
316 | } | |
317 |
|
317 | |||
318 |
|
318 | /*! | ||
|
319 | \internal | |||
|
320 | */ | |||
319 | void QXYSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) |
|
321 | void QXYSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) | |
320 | { |
|
322 | { | |
321 | Q_UNUSED(bottomRight) |
|
323 | Q_UNUSED(bottomRight) | |
@@ -329,6 +331,9 void QXYSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) | |||||
329 | } |
|
331 | } | |
330 | } |
|
332 | } | |
331 |
|
333 | |||
|
334 | /*! | |||
|
335 | \internal | |||
|
336 | */ | |||
332 | void QXYSeries::modelDataAboutToBeAdded(QModelIndex parent, int start, int end) |
|
337 | void QXYSeries::modelDataAboutToBeAdded(QModelIndex parent, int start, int end) | |
333 | { |
|
338 | { | |
334 | Q_UNUSED(parent) |
|
339 | Q_UNUSED(parent) | |
@@ -359,6 +364,9 void QXYSeries::modelDataAboutToBeAdded(QModelIndex parent, int start, int end) | |||||
359 | } |
|
364 | } | |
360 | } |
|
365 | } | |
361 |
|
366 | |||
|
367 | /*! | |||
|
368 | \internal | |||
|
369 | */ | |||
362 | void QXYSeries::modelDataAdded(QModelIndex parent, int start, int end) |
|
370 | void QXYSeries::modelDataAdded(QModelIndex parent, int start, int end) | |
363 | { |
|
371 | { | |
364 | Q_UNUSED(parent) |
|
372 | Q_UNUSED(parent) | |
@@ -386,6 +394,9 void QXYSeries::modelDataAdded(QModelIndex parent, int start, int end) | |||||
386 | } |
|
394 | } | |
387 | } |
|
395 | } | |
388 |
|
396 | |||
|
397 | /*! | |||
|
398 | \internal | |||
|
399 | */ | |||
389 | void QXYSeries::modelDataAboutToBeRemoved(QModelIndex parent, int start, int end) |
|
400 | void QXYSeries::modelDataAboutToBeRemoved(QModelIndex parent, int start, int end) | |
390 | { |
|
401 | { | |
391 | Q_UNUSED(parent) |
|
402 | Q_UNUSED(parent) | |
@@ -415,6 +426,9 void QXYSeries::modelDataAboutToBeRemoved(QModelIndex parent, int start, int end | |||||
415 | } |
|
426 | } | |
416 | } |
|
427 | } | |
417 |
|
428 | |||
|
429 | /*! | |||
|
430 | \internal | |||
|
431 | */ | |||
418 | void QXYSeries::modelDataRemoved(QModelIndex parent, int start, int end) |
|
432 | void QXYSeries::modelDataRemoved(QModelIndex parent, int start, int end) | |
419 | { |
|
433 | { | |
420 | Q_UNUSED(parent) |
|
434 | Q_UNUSED(parent) | |
@@ -450,6 +464,15 void QXYSeries::modelDataRemoved(QModelIndex parent, int start, int end) | |||||
450 | } |
|
464 | } | |
451 | } |
|
465 | } | |
452 |
|
466 | |||
|
467 | /*! | |||
|
468 | \fn QAbstractItemModel* QXYSeries::model() | |||
|
469 | Returns the model from which the series takes its data. | |||
|
470 | */ | |||
|
471 | ||||
|
472 | /*! | |||
|
473 | \fn bool QXYSeries::setModel(QAbstractItemModel *model) | |||
|
474 | Sets the \a model to be used as a data source | |||
|
475 | */ | |||
453 | bool QXYSeries::setModel(QAbstractItemModel *model) { |
|
476 | bool QXYSeries::setModel(QAbstractItemModel *model) { | |
454 |
|
477 | |||
455 | // disconnect signals from old model |
|
478 | // disconnect signals from old model |
@@ -26,6 +26,8 | |||||
26 | #include <QPen> |
|
26 | #include <QPen> | |
27 | #include <QBrush> |
|
27 | #include <QBrush> | |
28 |
|
28 | |||
|
29 | class QModelIndex; | |||
|
30 | ||||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
32 | |||
31 | class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries |
|
33 | class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries | |
@@ -60,7 +62,7 public: | |||||
60 | QBrush brush() const {return m_brush;} |
|
62 | QBrush brush() const {return m_brush;} | |
61 |
|
63 | |||
62 | bool setModel(QAbstractItemModel *model); |
|
64 | bool setModel(QAbstractItemModel *model); | |
63 | QAbstractItemModel* model() const { return m_model; } |
|
65 | // QAbstractItemModel* model() const { return m_model; } | |
64 |
|
66 | |||
65 | virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); |
|
67 | virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); | |
66 | virtual void setModelMappingRange(int first, int count = 0); |
|
68 | virtual void setModelMappingRange(int first, int count = 0); |
General Comments 0
You need to be logged in to leave comments.
Login now