Model mapper for bar series. 更多...
| import 语句: |
import QtGraphs
|
| 在 C++: | QBarModelMapper |
The BarModelMapper type enables using a data model derived from the QAbstractItemModel class as a data source for a graph. A model mapper is used to create a connection between a data model and QBarSeries . You need to implement the data model and expose it to QML.
Both model and bar series properties can be used to manipulate the data. The model mapper keeps the bar series and the data model in sync.
The model mapper ensures that all the bar sets in the bar series have equal sizes. Therefore, adding or removing a value from a bar set causes the same change to be made in all the bar sets in the bar series.
The following QML code snippet creates a bar series with three bar sets (assuming the model has at least four columns). Each bar set contains data starting from row 1. The name of a bar set is defined by the column header.
BarSeries { BarModelMapper { model: myCustomModel // QAbstractItemModel derived implementation firstBarSetColumn: 1 lastBarSetColumn: 3 firstRow: 1 orientation: Qt.Vertical } }
|
count : qsizetype |
The number of rows or columns of the model that are mapped as the data for the bar series. The default value is
-1
which is also the minimum. The count is limited by the number of model's rows/columns.
另请参阅 orientation .
|
first : qsizetype |
The row or column of the model that contains the first values of the bar sets in the bar series. The default value is 0.
另请参阅 orientation .
|
firstBarSetSection : qsizetype |
The section of the model that is used as the data source for the first bar set. The default value is -1 (invalid mapping).
另请参阅 orientation .
|
lastBarSetSection : qsizetype |
The section of the model that is used as the data source for the last bar set. The default value is -1 (invalid mapping).
另请参阅 orientation .
|
model : model |
The data model that is used by the mapper. You need to implement the model and expose it to QML.
注意: The model has to support adding and removing rows or columns and modifying the data in the cells.
|
orientation : orientation |
Tells the modelmapper how to map data from a model. If
Qt.Vertical
is used, each of the model's columns defines a bar set, and the model's rows define the categories. When the orientation is set to
Qt.Horizontal
, each of the model's rows defines a bar set, and the model's columns define categories.
|
series : BarSeries |
The bar series that is used by the mapper. All the data in the series is discarded when it is set to the mapper. When the new series is specified, the old series is disconnected, but it preserves its data.
|
countChanged () |
This signal is emitted when the number of rows or columns changes.
注意:
相应处理程序是
onCountChanged
.
|
firstBarSetSectionChanged () |
This signal is emitted when the first bar set section changes.
注意:
相应处理程序是
onFirstBarSetSectionChanged
.
|
firstChanged () |
This signal is emitted when the first row or column changes.
注意:
相应处理程序是
onFirstChanged
.
|
lastBarSetSectionChanged () |
This signal is emitted when the last bar set section changes.
注意:
相应处理程序是
onLastBarSetSectionChanged
.
|
modelChanged () |
This signal is emitted when the model that the mapper is connected to changes.
注意:
相应处理程序是
onModelChanged
.
|
orientationChanged () |
This signal is emitted when the orientation changes.
注意:
相应处理程序是
onOrientationChanged
.
|
orientationChanged () |
This signal is emitted when the orientation changes.
注意:
相应处理程序是
onOrientationChanged
.
|
seriesChanged () |
This signal is emitted when the bar series that the mapper is connected to changes.
注意:
相应处理程序是
onSeriesChanged
.