QBarModelMapper Class
QBarModelMapper 类是条形图系列的模型映射器。更多
Header: | #include <QBarModelMapper> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
qmake: | QT += graphs |
在 QML 中: | BarModelMapper |
继承: | QObject |
- 所有成员的列表,包括继承成员
- QBarModelMapper 是Qt Graphs C++ Classes for 2D 的一部分。
属性
|
|
公共功能
qsizetype | count() const |
qsizetype | first() const |
qsizetype | firstBarSetSection() const |
qsizetype | lastBarSetSection() const |
QAbstractItemModel * | model() const |
Qt::Orientation | orientation() const |
QBarSeries * | series() const |
void | setCount(qsizetype newCount) |
void | setFirst(qsizetype newFirst) |
void | setFirstBarSetSection(qsizetype newFirstBarSetSection) |
void | setLastBarSetSection(qsizetype newLastBarSetSection) |
void | setModel(QAbstractItemModel *model) |
void | setOrientation(Qt::Orientation orientation) |
void | setSeries(QBarSeries *series) |
信号
void | countChanged() |
void | firstBarSetSectionChanged() |
void | firstChanged() |
void | lastBarSetSectionChanged() |
void | modelChanged() |
void | orientationChanged() |
void | seriesChanged() |
详细说明
模型映射器可将源自QAbstractItemModel 类的数据模型用作图形的数据源。模型映射器用于在数据模型和QBarSeries 之间创建连接。
模型和条形序列属性都可用于操作数据。模型映射器使条形序列和数据模型保持同步。
模型映射器确保条形序列中的所有条形集大小相等。因此,添加或删除某个条形集的值会导致条形序列中的所有条形集发生相同的变化。
属性文档
count : qsizetype
该属性用于保存被映射为条形图数据的模型行数或列数。
默认值是-1
,也是最小值。计数受模型行/列数的限制。
访问功能:
qsizetype | count() const |
void | setCount(qsizetype newCount) |
通知信号:
void | countChanged() |
另请参见 QBarModelMapper::orientation 。
first : qsizetype
此属性用于保存模型中包含条形图系列中条形图组的第一个值的行或列。
最小默认值为 0。
访问功能:
qsizetype | first() const |
void | setFirst(qsizetype newFirst) |
通知信号:
void | firstChanged() |
另请参阅 QBarModelMapper::orientation 。
firstBarSetSection : qsizetype
该属性用于保存作为第一个条形图集数据源的模型部分。
默认值为-1(无效映射)。
访问功能:
qsizetype | firstBarSetSection() const |
void | setFirstBarSetSection(qsizetype newFirstBarSetSection) |
通知信号:
void | firstBarSetSectionChanged() |
另请参阅 QBarModelMapper::orientation 。
lastBarSetSection : qsizetype
该属性用于保存模型中用作最后一个条形图集数据源的部分。
默认值为-1(无效映射)。
访问功能:
qsizetype | lastBarSetSection() const |
void | setLastBarSetSection(qsizetype newLastBarSetSection) |
通知信号:
void | lastBarSetSectionChanged() |
另请参阅 QBarModelMapper::orientation 。
model : QAbstractItemModel*
该属性包含映射器使用的数据模型。
访问功能:
QAbstractItemModel * | model() const |
void | setModel(QAbstractItemModel *model) |
Notifier 信号:
void | modelChanged() |
orientation : Qt::Orientation
告诉 modelmapper 如何映射模型中的数据。如果使用Qt::Vertical
,模型的每一列定义一个条形集,模型的行定义类别。当方向设置为Qt::Horizontal
时,模型的每一行定义一个条形集,模型的列定义类别。
默认值为Qt::Vertical
访问功能:
Qt::Orientation | orientation() const |
void | setOrientation(Qt::Orientation orientation) |
通知信号:
void | orientationChanged() |
series : QBarSeries*
该属性包含映射器使用的柱状图系列。
当映射器设置该属性时,系列中的所有数据都会被丢弃。指定新系列时,旧系列将断开连接,但保留其数据。
访问功能:
QBarSeries * | series() const |
void | setSeries(QBarSeries *series) |
通知信号:
void | seriesChanged() |
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.