QLineSeries Class
QLineSeries 类用于以折线图的形式展示数据。更多内容...
| 头文件: | #include <QLineSeries> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
| qmake: | QT += graphs |
| 在 QML 中: | LineSeries |
| 继承自: | QXYSeries |
- 所有成员列表(包括继承的成员)
- QLineSeries 属于Qt Graphs 的2D C++ 类库。
公共类型
(since 6.11) enum class | LineStyle { Straight, StepLeft, StepRight, StepCenter } |
(since 6.11) enum class | StrokeStyle { SolidLine, DashLine } |
属性
|
|
公共函数
| Qt::PenCapStyle | capStyle() const |
| qreal | dashOffset() const |
| QList<qreal> | dashPattern() const |
| QPointF | dataPointCoordinatesAt(qreal x, qreal y) |
| Qt::PenJoinStyle | joinStyle() const |
| QLineSeries::LineStyle | lineStyle() const |
| void | setCapStyle(Qt::PenCapStyle newCapStyle) |
| void | setDashOffset(qreal newDashOffset) |
| void | setDashPattern(const QList<qreal> &pattern) |
| void | setJoinStyle(Qt::PenJoinStyle newJoinStyle) |
| void | setLineStyle(QLineSeries::LineStyle newLineStyle) |
| void | setStrokeStyle(QLineSeries::StrokeStyle newStrokeStyle) |
| void | setWidth(qreal newWidth) |
| QLineSeries::StrokeStyle | strokeStyle() const |
| qreal | width() const |
信号
| void | capStyleChanged() |
| void | dashOffsetChanged(qreal newDashOffset) |
| void | dashPatternChanged(const QList<qreal> &newDashPattern) |
| void | joinStyleChanged(Qt::PenJoinStyle newJoinStyle) |
| void | lineStyleChanged(QLineSeries::LineStyle newLineStyle) |
| void | strokeStyleChanged(QLineSeries::StrokeStyle newStrokeStyle) |
| void | widthChanged() |
成员类型文档
[since 6.11] enum class QLineSeries::LineStyle
表示该系列的线型。
| 常量 | 值 | 描述 |
|---|---|---|
QLineSeries::LineStyle::Straight | 0 | 各点由一条直线连接。 |
QLineSeries::LineStyle::StepLeft | 1 | 各点由阶梯连接,每个阶梯的高度为左侧的数值。 |
QLineSeries::LineStyle::StepRight | 2 | 各点通过阶梯连接,每个阶梯的高度即为左侧的数值。各点通过阶梯连接,每个阶梯的高度即为右侧的数值。 |
QLineSeries::LineStyle::StepCenter | 3 | 各点通过阶梯连接,且阶梯在两个数值之间呈渐变。 |
该枚举在 Qt 6.11 中引入。
[since 6.11] enum class QLineSeries::StrokeStyle
表示该系列的线条样式。默认值为 StrokeStyle.SolidLine。
| 常量 | 值 | 描述 |
|---|---|---|
QLineSeries::StrokeStyle::SolidLine | Qt::SolidLine | 实线。 |
QLineSeries::StrokeStyle::DashLine | Qt::DashLine | 间隔几个像素的短线。 |
该枚举在 Qt 6.11 中引入。
属性文档
capStyle : Qt::PenCapStyle
此属性用于指定行尾的装饰样式。
默认值为Qt.SquareCap 。
访问函数:
| Qt::PenCapStyle | capStyle() const |
| void | setCapStyle(Qt::PenCapStyle newCapStyle) |
通知信号:
| void | capStyleChanged() |
[since 6.11] dashOffset : qreal
当strokeStyle 设置为LineSeries.DashLine 时,该属性保存连字符偏移量。
该枚举在 Qt 6.11 中引入。
访问函数:
| qreal | dashOffset() const |
| void | setDashOffset(qreal newDashOffset) |
通知器信号:
| void | dashOffsetChanged(qreal newDashOffset) |
[since 6.11] dashPattern : QList<qreal>
当strokeStyle 设置为LineSeries.DashLine 时,该属性将保留连字符图案。
该枚举在 Qt 6.11 中引入。
访问函数:
| QList<qreal> | dashPattern() const |
| void | setDashPattern(const QList<qreal> &pattern) |
通知器信号:
| void | dashPatternChanged(const QList<qreal> &newDashPattern) |
[since 6.11] joinStyle : Qt::PenJoinStyle
此属性用于指定行尾的连接样式。
默认值为Qt.BevelJoin 。
该枚举类型于 Qt 6.11 中引入。
访问函数:
| Qt::PenJoinStyle | joinStyle() const |
| void | setJoinStyle(Qt::PenJoinStyle newJoinStyle) |
通知器信号:
| void | joinStyleChanged(Qt::PenJoinStyle newJoinStyle) |
[since 6.11] lineStyle : QLineSeries::LineStyle
该属性用于指定线条渲染时使用的线条样式。
默认值为LineSeries.Straight 。
该枚举在 Qt 6.11 中引入。
访问函数:
| QLineSeries::LineStyle | lineStyle() const |
| void | setLineStyle(QLineSeries::LineStyle newLineStyle) |
通知器信号:
| void | lineStyleChanged(QLineSeries::LineStyle newLineStyle) |
[since 6.11] strokeStyle : QLineSeries::StrokeStyle
该属性用于指定序列的描边样式。
默认值为LineSeries.SolidLine 。
该枚举在 Qt 6.11 中引入。
访问函数:
| QLineSeries::StrokeStyle | strokeStyle() const |
| void | setStrokeStyle(QLineSeries::StrokeStyle newStrokeStyle) |
通知信号:
| void | strokeStyleChanged(QLineSeries::StrokeStyle newStrokeStyle) |
width : qreal
该属性存储了该系列中线条的宽度。
该属性存储用于绘制该系列线条的笔宽。
访问函数:
| qreal | width() const |
| void | setWidth(qreal newWidth) |
通知信号:
| void | widthChanged() |
成员函数文档
[invokable] QPointF QLineSeries::dataPointCoordinatesAt(qreal x, qreal y)
返回将 `x ` 和 `y ` 的渲染坐标转换为数据点坐标的值。
注意:该 函数可通过元对象系统和 QML 调用。参见Q_INVOKABLE 。
© 2026 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.