QLineSeries Class
QLineSeries 类以折线图表示数据。更多
| Header: | #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 C++ Classes for 2D 的一部分。
公共类型
(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) |
Notifier 信号:
| 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) |
Notifier 信号:
| 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) |
Notifier 信号:
| 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) |
Notifier 信号:
| 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) |
Notifier 信号:
| void | strokeStyleChanged(QLineSeries::StrokeStyle newStrokeStyle) |
width : qreal
该属性表示系列中线条的宽度。
该属性保存用于绘制系列线的钢笔宽度。
访问功能:
| qreal | width() const |
| void | setWidth(qreal newWidth) |
Notifier 信号:
| 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.