##// END OF EJS Templates
Updated QML bar model mapper property names
Tero Ahola -
r1496:46e4d06d4e0f
parent child
Show More
@@ -1,155 +1,155
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 import QtQuick 1.0
21 import QtQuick 1.0
22 import QtCommercial.Chart 1.0
22 import QtCommercial.Chart 1.0
23 import QmlCustomModel 1.0
23 import QmlCustomModel 1.0
24
24
25 Rectangle {
25 Rectangle {
26 anchors.fill: parent
26 anchors.fill: parent
27
27
28 //![1]
28 //![1]
29 ChartView {
29 ChartView {
30 id: chartView
30 id: chartView
31 title: "Top-5 car brand shares in Finland"
31 title: "Top-5 car brand shares in Finland"
32 anchors.fill: parent
32 anchors.fill: parent
33 axisX.max: 10
33 axisX.max: 10
34 axisX.min: 0
34 axisX.min: 0
35 axisY.max: 20
35 axisY.max: 20
36 axisY.min: 0
36 axisY.min: 0
37 animationOptions: ChartView.SeriesAnimations
37 animationOptions: ChartView.SeriesAnimations
38 axisXLabels: [0, "2007", 1, "2008", 2, "2009", 3, "2010", 4, "2011", 5, "2012"]
38 axisXLabels: [0, "2007", 1, "2008", 2, "2009", 3, "2010", 4, "2011", 5, "2012"]
39 // ...
39 // ...
40 //![1]
40 //![1]
41
41
42 //![2]
42 //![2]
43 CustomModel {
43 CustomModel {
44 id: customModel
44 id: customModel
45 verticalHeaders: ["Manufacturer", "Volkswagen", "Toyota", "Ford", "Skoda", "Volvo", "Others"]
45 verticalHeaders: ["Manufacturer", "Volkswagen", "Toyota", "Ford", "Skoda", "Volvo", "Others"]
46 CustomModelElement { values: [0, "Manufacturer", 0, 1, 2, 3, 4] }
46 CustomModelElement { values: [0, "Manufacturer", 0, 1, 2, 3, 4] }
47 CustomModelElement { values: [1, "Volkswagen", 10.3, 12.0, 12.8, 13.0, 13.8] }
47 CustomModelElement { values: [1, "Volkswagen", 10.3, 12.0, 12.8, 13.0, 13.8] }
48 CustomModelElement { values: [2, "Toyota", 13.8, 13.5, 16.2, 13.7, 10.7] }
48 CustomModelElement { values: [2, "Toyota", 13.8, 13.5, 16.2, 13.7, 10.7] }
49 CustomModelElement { values: [3, "Ford", 6.4, 7.1, 8.9, 8.2, 8.6] }
49 CustomModelElement { values: [3, "Ford", 6.4, 7.1, 8.9, 8.2, 8.6] }
50 CustomModelElement { values: [4, "Skoda", 4.7, 5.8, 6.9, 8.3, 8.2] }
50 CustomModelElement { values: [4, "Skoda", 4.7, 5.8, 6.9, 8.3, 8.2] }
51 CustomModelElement { values: [5, "Volvo", 7.1, 6.7, 6.5, 6.3, 7.0] }
51 CustomModelElement { values: [5, "Volvo", 7.1, 6.7, 6.5, 6.3, 7.0] }
52 CustomModelElement { values: [6, "Others", 57.7, 54.9, 48.7, 50.5, 51.7] }
52 CustomModelElement { values: [6, "Others", 57.7, 54.9, 48.7, 50.5, 51.7] }
53 }
53 }
54 //![2]
54 //![2]
55
55
56 //![5]
56 //![5]
57 BarSeries {
57 BarSeries {
58 name: "Others"
58 name: "Others"
59 barWidth: 0.9
59 barWidth: 0.9
60 visible: false
60 visible: false
61 HBarModelMapper {
61 HBarModelMapper {
62 model: customModel
62 model: customModel
63 firstBarSetRow: 6
63 firstBarSetRow: 6
64 lastBarSetRow: 6
64 lastBarSetRow: 6
65 first: 2
65 firstColumn: 2
66 }
66 }
67 }
67 }
68 //![5]
68 //![5]
69
69
70 //![4]
70 //![4]
71 LineSeries {
71 LineSeries {
72 name: "Volkswagen"
72 name: "Volkswagen"
73 visible: false
73 visible: false
74 HXYModelMapper {
74 HXYModelMapper {
75 model: customModel
75 model: customModel
76 xRow: 0
76 xRow: 0
77 yRow: 1
77 yRow: 1
78 first: 2
78 first: 2
79 }
79 }
80 }
80 }
81 //![4]
81 //![4]
82
82
83 LineSeries {
83 LineSeries {
84 name: "Toyota"
84 name: "Toyota"
85 visible: false
85 visible: false
86 HXYModelMapper {
86 HXYModelMapper {
87 model: customModel
87 model: customModel
88 xRow: 0
88 xRow: 0
89 yRow: 2
89 yRow: 2
90 first: 2
90 first: 2
91 }
91 }
92 }
92 }
93
93
94 LineSeries {
94 LineSeries {
95 name: "Ford"
95 name: "Ford"
96 visible: false
96 visible: false
97 HXYModelMapper {
97 HXYModelMapper {
98 model: customModel
98 model: customModel
99 xRow: 0
99 xRow: 0
100 yRow: 3
100 yRow: 3
101 first: 2
101 first: 2
102 }
102 }
103 }
103 }
104
104
105 LineSeries {
105 LineSeries {
106 name: "Skoda"
106 name: "Skoda"
107 visible: false
107 visible: false
108 HXYModelMapper {
108 HXYModelMapper {
109 model: customModel
109 model: customModel
110 xRow: 0
110 xRow: 0
111 yRow: 4
111 yRow: 4
112 first: 2
112 first: 2
113 }
113 }
114 }
114 }
115
115
116 LineSeries {
116 LineSeries {
117 name: "Volvo"
117 name: "Volvo"
118 visible: false
118 visible: false
119 HXYModelMapper {
119 HXYModelMapper {
120 model: customModel
120 model: customModel
121 xRow: 0
121 xRow: 0
122 yRow: 5
122 yRow: 5
123 first: 2
123 first: 2
124 }
124 }
125 }
125 }
126
126
127 //![3]
127 //![3]
128 PieSeries {
128 PieSeries {
129 id: pieSeries
129 id: pieSeries
130 size: 0.4
130 size: 0.4
131 horizontalPosition: 0.7
131 horizontalPosition: 0.7
132 verticalPosition: 0.4
132 verticalPosition: 0.4
133 onClicked: {
133 onClicked: {
134 // Show the selection by exploding the slice
134 // Show the selection by exploding the slice
135 slice.exploded = !slice.exploded;
135 slice.exploded = !slice.exploded;
136
136
137 // Update the line series to show the yearly data for this slice
137 // Update the line series to show the yearly data for this slice
138 for (var i = 0; i < chartView.count; i++) {
138 for (var i = 0; i < chartView.count; i++) {
139 if (chartView.series(i).name == slice.label) {
139 if (chartView.series(i).name == slice.label) {
140 chartView.series(i).visible = slice.exploded;
140 chartView.series(i).visible = slice.exploded;
141 }
141 }
142 }
142 }
143 }
143 }
144 }
144 }
145 //![3]
145 //![3]
146
146
147 VPieModelMapper {
147 VPieModelMapper {
148 series: pieSeries
148 series: pieSeries
149 model: customModel
149 model: customModel
150 labelsColumn: 1
150 labelsColumn: 1
151 valuesColumn: 2
151 valuesColumn: 2
152 first: 1
152 first: 1
153 }
153 }
154 }
154 }
155 }
155 }
@@ -1,178 +1,178
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include "qhbarmodelmapper.h"
21 #include "qhbarmodelmapper.h"
22
22
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24
24
25 /*!
25 /*!
26 \class QHBarModelMapper
26 \class QHBarModelMapper
27 \brief part of QtCommercial chart API.
27 \brief part of QtCommercial chart API.
28 \mainclass
28 \mainclass
29
29
30 Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
30 Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
31 Horizontal model mapper is used to create a connection between QBarSeries and QAbstractItemModel derived model object.
31 Horizontal model mapper is used to create a connection between QBarSeries and QAbstractItemModel derived model object.
32 Model mapper maintains equal size of all the BarSets.
32 Model mapper maintains equal size of all the BarSets.
33 Adding/removing value from the BarSet causes the the same change in the rest of the BarSets added to the same series.
33 Adding/removing value from the BarSet causes the the same change in the rest of the BarSets added to the same series.
34 NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells.
34 NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells.
35 */
35 */
36 /*!
36 /*!
37 \qmlclass HBarModelMapper
37 \qmlclass HBarModelMapper
38 \inherits BarModelMapper
38 \inherits BarModelMapper
39 \mainclass
39 \mainclass
40
40
41 HBarModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as a data source
41 HBarModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as a data source
42 for any bar series. The following QML example would create a bar series with three bar sets (assuming the model has
42 for any bar series. The following QML example would create a bar series with three bar sets (assuming the model has
43 at least four rows). Each bar set would contain data starting from column 1. The name of a set would be defined
43 at least four rows). Each bar set would contain data starting from column 1. The name of a set would be defined
44 by the vertical header (of the row).
44 by the vertical header (of the row).
45 \code
45 \code
46 BarSeries {
46 BarSeries {
47 HBarModelMapper {
47 HBarModelMapper {
48 model: myCustomModel
48 model: myCustomModel
49 firstBarSetRow: 1
49 firstBarSetRow: 1
50 lastBarSetRow: 3
50 lastBarSetRow: 3
51 first: 1
51 firstColumn: 1
52 }
52 }
53 }
53 }
54 \endcode
54 \endcode
55 */
55 */
56
56
57 /*!
57 /*!
58 \property QHBarModelMapper::firstBarSetRow
58 \property QHBarModelMapper::firstBarSetRow
59 \brief Defines which column of the model is used as the data source for the first bar set
59 \brief Defines which column of the model is used as the data source for the first bar set
60
60
61 Default value is: -1 (invalid mapping)
61 Default value is: -1 (invalid mapping)
62 */
62 */
63
63
64 /*!
64 /*!
65 \property QHBarModelMapper::lastBarSetRow
65 \property QHBarModelMapper::lastBarSetRow
66 \brief Defines which column of the model is used as the data source for the last bar set
66 \brief Defines which column of the model is used as the data source for the last bar set
67
67
68 Default value is: -1 (invalid mapping)
68 Default value is: -1 (invalid mapping)
69 */
69 */
70
70
71 /*!
71 /*!
72 \property QHBarModelMapper::firstColumn
72 \property QHBarModelMapper::firstColumn
73 \brief Defines which column of the model contains the first values of the QBarSets in the series.
73 \brief Defines which column of the model contains the first values of the QBarSets in the series.
74 Minimal and default value is: 0
74 Minimal and default value is: 0
75 */
75 */
76 /*!
76 /*!
77 \qmlproperty int BarModelMapper::first
77 \qmlproperty int BarModelMapper::firstColumn
78 Defines which column of the model contains the first values of the QBarSets in the series.
78 Defines which column of the model contains the first values of the QBarSets in the series.
79 The default value is 0.
79 The default value is 0.
80 */
80 */
81
81
82 /*!
82 /*!
83 \property QHBarModelMapper::columnCount
83 \property QHBarModelMapper::columnCount
84 \brief Defines the number of rows of the model that are mapped as the data for QBarSeries
84 \brief Defines the number of rows of the model that are mapped as the data for QBarSeries
85 Minimal and default value is: -1 (count limited by the number of rows in the model)
85 Minimal and default value is: -1 (count limited by the number of rows in the model)
86 */
86 */
87 /*!
87 /*!
88 \qmlproperty int BarModelMapper::count
88 \qmlproperty int BarModelMapper::columnCount
89 Defines the number of rows of the model that are mapped as the data for QBarSeries. The default value is
89 Defines the number of rows of the model that are mapped as the data for QBarSeries. The default value is
90 -1 (count limited by the number of rows in the model)
90 -1 (count limited by the number of rows in the model)
91 */
91 */
92
92
93 /*!
93 /*!
94 \fn void QHBarModelMapper::firstBarSetRowChanged()
94 \fn void QHBarModelMapper::firstBarSetRowChanged()
95
95
96 Emitted when the firstBarSetRow has changed.
96 Emitted when the firstBarSetRow has changed.
97 */
97 */
98
98
99 /*!
99 /*!
100 \fn void QHBarModelMapper::lastBarSetRowChanged()
100 \fn void QHBarModelMapper::lastBarSetRowChanged()
101
101
102 Emitted when the lastBarSetRow has changed.
102 Emitted when the lastBarSetRow has changed.
103 */
103 */
104
104
105 /*!
105 /*!
106 \fn void QHBarModelMapper::firstColumnChanged()
106 \fn void QHBarModelMapper::firstColumnChanged()
107 Emitted when the firstColumn has changed.
107 Emitted when the firstColumn has changed.
108 */
108 */
109
109
110 /*!
110 /*!
111 \fn void QHBarModelMapper::columnCountChanged()
111 \fn void QHBarModelMapper::columnCountChanged()
112 Emitted when the columnCount has changed.
112 Emitted when the columnCount has changed.
113 */
113 */
114
114
115 /*!
115 /*!
116 Constructs a mapper object which is a child of \a parent.
116 Constructs a mapper object which is a child of \a parent.
117 */
117 */
118 QHBarModelMapper::QHBarModelMapper(QObject *parent) :
118 QHBarModelMapper::QHBarModelMapper(QObject *parent) :
119 QBarModelMapper(parent)
119 QBarModelMapper(parent)
120 {
120 {
121 QBarModelMapper::setOrientation(Qt::Horizontal);
121 QBarModelMapper::setOrientation(Qt::Horizontal);
122 }
122 }
123
123
124 int QHBarModelMapper::firstBarSetRow() const
124 int QHBarModelMapper::firstBarSetRow() const
125 {
125 {
126 return QBarModelMapper::firstBarSetSection();
126 return QBarModelMapper::firstBarSetSection();
127 }
127 }
128
128
129 void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow)
129 void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow)
130 {
130 {
131 if (firstBarSetRow != firstBarSetSection()) {
131 if (firstBarSetRow != firstBarSetSection()) {
132 QBarModelMapper::setFirstBarSetSection(firstBarSetRow);
132 QBarModelMapper::setFirstBarSetSection(firstBarSetRow);
133 emit firstBarSetRowChanged();
133 emit firstBarSetRowChanged();
134 }
134 }
135 }
135 }
136
136
137 int QHBarModelMapper::lastBarSetRow() const
137 int QHBarModelMapper::lastBarSetRow() const
138 {
138 {
139 return QBarModelMapper::lastBarSetSection();
139 return QBarModelMapper::lastBarSetSection();
140 }
140 }
141
141
142 void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow)
142 void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow)
143 {
143 {
144 if (lastBarSetRow != lastBarSetSection()) {
144 if (lastBarSetRow != lastBarSetSection()) {
145 QBarModelMapper::setLastBarSetSection(lastBarSetRow);
145 QBarModelMapper::setLastBarSetSection(lastBarSetRow);
146 emit lastBarSetRowChanged();
146 emit lastBarSetRowChanged();
147 }
147 }
148 }
148 }
149
149
150 int QHBarModelMapper::firstColumn() const
150 int QHBarModelMapper::firstColumn() const
151 {
151 {
152 return QBarModelMapper::first();
152 return QBarModelMapper::first();
153 }
153 }
154
154
155 void QHBarModelMapper::setFirstColumn(int firstColumn)
155 void QHBarModelMapper::setFirstColumn(int firstColumn)
156 {
156 {
157 if (firstColumn != first()) {
157 if (firstColumn != first()) {
158 QBarModelMapper::setFirst(firstColumn);
158 QBarModelMapper::setFirst(firstColumn);
159 emit firstColumnChanged();
159 emit firstColumnChanged();
160 }
160 }
161 }
161 }
162
162
163 int QHBarModelMapper::columnCount() const
163 int QHBarModelMapper::columnCount() const
164 {
164 {
165 return QBarModelMapper::count();
165 return QBarModelMapper::count();
166 }
166 }
167
167
168 void QHBarModelMapper::setColumnCount(int columnCount)
168 void QHBarModelMapper::setColumnCount(int columnCount)
169 {
169 {
170 if (columnCount != count()) {
170 if (columnCount != count()) {
171 QBarModelMapper::setCount(columnCount);
171 QBarModelMapper::setCount(columnCount);
172 emit firstColumnChanged();
172 emit firstColumnChanged();
173 }
173 }
174 }
174 }
175
175
176 #include "moc_qhbarmodelmapper.cpp"
176 #include "moc_qhbarmodelmapper.cpp"
177
177
178 QTCOMMERCIALCHART_END_NAMESPACE
178 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,184 +1,184
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include "qvbarmodelmapper.h"
21 #include "qvbarmodelmapper.h"
22
22
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
23 QTCOMMERCIALCHART_BEGIN_NAMESPACE
24
24
25 /*!
25 /*!
26 \class QVBarModelMapper
26 \class QVBarModelMapper
27 \brief part of QtCommercial chart API.
27 \brief part of QtCommercial chart API.
28 \mainclass
28 \mainclass
29
29
30 Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
30 Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
31 Vertical model mapper is used to create a connection between QBarSeries and QAbstractItemModel derived model object.
31 Vertical model mapper is used to create a connection between QBarSeries and QAbstractItemModel derived model object.
32 Model mapper maintains equal size of all the BarSets.
32 Model mapper maintains equal size of all the BarSets.
33 Adding/removing value from the BarSet causes the the same change in the rest of the BarSets added to the same series.
33 Adding/removing value from the BarSet causes the the same change in the rest of the BarSets added to the same series.
34 NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells.
34 NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells.
35 */
35 */
36 /*!
36 /*!
37 \qmlclass VBarModelMapper
37 \qmlclass VBarModelMapper
38 \inherits BarModelMapper
38 \inherits BarModelMapper
39 \mainclass
39 \mainclass
40
40
41 VBarModelMapper allows you to use your own QAbstractItemModel derived model with data in columns as a data source
41 VBarModelMapper allows you to use your own QAbstractItemModel derived model with data in columns as a data source
42 for any bar series. The following QML example would create a bar series with three bar sets (assuming the model has
42 for any bar series. The following QML example would create a bar series with three bar sets (assuming the model has
43 at least four columns). Each bar set would contain data starting from row 1. The name of a set would be defined
43 at least four columns). Each bar set would contain data starting from row 1. The name of a set would be defined
44 by the horizontal header (of the column).
44 by the horizontal header (of the column).
45 \code
45 \code
46 GroupedBarSeries {
46 GroupedBarSeries {
47 VBarModelMapper {
47 VBarModelMapper {
48 model: myCustomModel
48 model: myCustomModel
49 firstBarSetColumn: 1
49 firstBarSetColumn: 1
50 lastBarSetColumn: 3
50 lastBarSetColumn: 3
51 first: 1
51 firstRow: 1
52 }
52 }
53 }
53 }
54 \endcode
54 \endcode
55 */
55 */
56
56
57 /*!
57 /*!
58 \property QVBarModelMapper::firstBarSetColumn
58 \property QVBarModelMapper::firstBarSetColumn
59 \brief Defines which column of the model is used as the data source for the first bar set
59 \brief Defines which column of the model is used as the data source for the first bar set
60 Default value is: -1 (invalid mapping)
60 Default value is: -1 (invalid mapping)
61 */
61 */
62 /*!
62 /*!
63 \qmlproperty int VBarModelMapper::firstBarSetColumn
63 \qmlproperty int VBarModelMapper::firstBarSetColumn
64 Defines which column of the model is used as the data source for the first bar set. Default value
64 Defines which column of the model is used as the data source for the first bar set. Default value
65 is: -1 (invalid mapping).
65 is: -1 (invalid mapping).
66 */
66 */
67
67
68 /*!
68 /*!
69 \property QVBarModelMapper::lastBarSetColumn
69 \property QVBarModelMapper::lastBarSetColumn
70 \brief Defines which column of the model is used as the data source for the last bar set
70 \brief Defines which column of the model is used as the data source for the last bar set
71 Default value is: -1 (invalid mapping)
71 Default value is: -1 (invalid mapping)
72 */
72 */
73 /*!
73 /*!
74 \qmlproperty int VBarModelMapper::lastBarSetColumn
74 \qmlproperty int VBarModelMapper::lastBarSetColumn
75 Defines which column of the model is used as the data source for the last bar set. Default
75 Defines which column of the model is used as the data source for the last bar set. Default
76 value is: -1 (invalid mapping).
76 value is: -1 (invalid mapping).
77 */
77 */
78
78
79 /*!
79 /*!
80 \property QVBarModelMapper::firstRow
80 \property QVBarModelMapper::firstRow
81 \brief Defines which row of the model contains the first values of the QBarSets in the series.
81 \brief Defines which row of the model contains the first values of the QBarSets in the series.
82 Minimal and default value is: 0
82 Minimal and default value is: 0
83 */
83 */
84 /*!
84 /*!
85 \qmlproperty int BarModelMapper::first
85 \qmlproperty int BarModelMapper::firstRow
86 Defines which row of the model contains the first values of the QBarSets in the series.
86 Defines which row of the model contains the first values of the QBarSets in the series.
87 The default value is 0.
87 The default value is 0.
88 */
88 */
89
89
90 /*!
90 /*!
91 \property QVBarModelMapper::rowCount
91 \property QVBarModelMapper::rowCount
92 \brief Defines the number of rows of the model that are mapped as the data for QBarSeries
92 \brief Defines the number of rows of the model that are mapped as the data for QBarSeries
93 Minimal and default value is: -1 (count limited by the number of rows in the model)
93 Minimal and default value is: -1 (count limited by the number of rows in the model)
94 */
94 */
95 /*!
95 /*!
96 \qmlproperty int BarModelMapper::count
96 \qmlproperty int BarModelMapper::rowCount
97 Defines the number of rows of the model that are mapped as the data for QBarSeries. The default value is
97 Defines the number of rows of the model that are mapped as the data for QBarSeries. The default value is
98 -1 (count limited by the number of rows in the model)
98 -1 (count limited by the number of rows in the model)
99 */
99 */
100
100
101 /*!
101 /*!
102 \fn void QVBarModelMapper::firstBarSetColumnChanged()
102 \fn void QVBarModelMapper::firstBarSetColumnChanged()
103 Emitted when the firstBarSetColumn has changed.
103 Emitted when the firstBarSetColumn has changed.
104 */
104 */
105
105
106 /*!
106 /*!
107 \fn void QVBarModelMapper::lastBarSetColumnChanged()
107 \fn void QVBarModelMapper::lastBarSetColumnChanged()
108 Emitted when the lastBarSetColumn has changed.
108 Emitted when the lastBarSetColumn has changed.
109 */
109 */
110
110
111 /*!
111 /*!
112 \fn void QVBarModelMapper::firstRowChanged()
112 \fn void QVBarModelMapper::firstRowChanged()
113 Emitted when the firstRow has changed.
113 Emitted when the firstRow has changed.
114 */
114 */
115
115
116 /*!
116 /*!
117 \fn void QVBarModelMapper::rowCountChanged()
117 \fn void QVBarModelMapper::rowCountChanged()
118 Emitted when the rowCount has changed.
118 Emitted when the rowCount has changed.
119 */
119 */
120
120
121 /*!
121 /*!
122 Constructs a mapper object which is a child of \a parent.
122 Constructs a mapper object which is a child of \a parent.
123 */
123 */
124 QVBarModelMapper::QVBarModelMapper(QObject *parent) :
124 QVBarModelMapper::QVBarModelMapper(QObject *parent) :
125 QBarModelMapper(parent)
125 QBarModelMapper(parent)
126 {
126 {
127 QBarModelMapper::setOrientation(Qt::Vertical);
127 QBarModelMapper::setOrientation(Qt::Vertical);
128 }
128 }
129
129
130 int QVBarModelMapper::firstBarSetColumn() const
130 int QVBarModelMapper::firstBarSetColumn() const
131 {
131 {
132 return QBarModelMapper::firstBarSetSection();
132 return QBarModelMapper::firstBarSetSection();
133 }
133 }
134
134
135 void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn)
135 void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn)
136 {
136 {
137 if (firstBarSetColumn != firstBarSetSection()) {
137 if (firstBarSetColumn != firstBarSetSection()) {
138 QBarModelMapper::setFirstBarSetSection(firstBarSetColumn);
138 QBarModelMapper::setFirstBarSetSection(firstBarSetColumn);
139 emit firstBarSetColumnChanged();
139 emit firstBarSetColumnChanged();
140 }
140 }
141 }
141 }
142
142
143 int QVBarModelMapper::lastBarSetColumn() const
143 int QVBarModelMapper::lastBarSetColumn() const
144 {
144 {
145 return QBarModelMapper::lastBarSetSection();
145 return QBarModelMapper::lastBarSetSection();
146 }
146 }
147
147
148 void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn)
148 void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn)
149 {
149 {
150 if (lastBarSetColumn != lastBarSetSection()) {
150 if (lastBarSetColumn != lastBarSetSection()) {
151 QBarModelMapper::setLastBarSetSection(lastBarSetColumn);
151 QBarModelMapper::setLastBarSetSection(lastBarSetColumn);
152 emit lastBarSetColumnChanged();
152 emit lastBarSetColumnChanged();
153 }
153 }
154 }
154 }
155
155
156 int QVBarModelMapper::firstRow() const
156 int QVBarModelMapper::firstRow() const
157 {
157 {
158 return QBarModelMapper::first();
158 return QBarModelMapper::first();
159 }
159 }
160
160
161 void QVBarModelMapper::setFirstRow(int firstRow)
161 void QVBarModelMapper::setFirstRow(int firstRow)
162 {
162 {
163 if (firstRow != first()) {
163 if (firstRow != first()) {
164 QBarModelMapper::setFirst(firstRow);
164 QBarModelMapper::setFirst(firstRow);
165 emit firstRowChanged();
165 emit firstRowChanged();
166 }
166 }
167 }
167 }
168
168
169 int QVBarModelMapper::rowCount() const
169 int QVBarModelMapper::rowCount() const
170 {
170 {
171 return QBarModelMapper::count();
171 return QBarModelMapper::count();
172 }
172 }
173
173
174 void QVBarModelMapper::setRowCount(int rowCount)
174 void QVBarModelMapper::setRowCount(int rowCount)
175 {
175 {
176 if (rowCount != count()) {
176 if (rowCount != count()) {
177 QBarModelMapper::setCount(rowCount);
177 QBarModelMapper::setCount(rowCount);
178 emit firstRowChanged();
178 emit firstRowChanged();
179 }
179 }
180 }
180 }
181
181
182 #include "moc_qvbarmodelmapper.cpp"
182 #include "moc_qvbarmodelmapper.cpp"
183
183
184 QTCOMMERCIALCHART_END_NAMESPACE
184 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now