QMediaTimeRange::Interval Struct
struct QMediaTimeRange::IntervalQMediaTimeRange::Interval 类表示具有整数精度的时间间隔。更多内容...
公共函数
| Interval() | |
| Interval(qint64 start, qint64 end) | |
| bool | contains(qint64 time) const |
| qint64 | end() const |
| bool | isNormal() const |
| QMediaTimeRange::Interval | normalized() const |
| qint64 | start() const |
| QMediaTimeRange::Interval | translated(qint64 offset) const |
相关的非成员
| bool | operator!=(QMediaTimeRange::Interval lhs, QMediaTimeRange::Interval rhs) |
| bool | operator==(QMediaTimeRange::Interval lhs, QMediaTimeRange::Interval rhs) |
详细说明
时间间隔由包含起始时间(start())和结束时间(end())来指定。由于这是一个不可变类,因此必须在构造函数中设置这些时间。该类所表示的具体时间单位尚未定义——它适用于任何可以用有符号 64 位整数表示的时间。
isNormal() 方法用于判断一个时间间隔是否为正常间隔(正常时间间隔满足start() <=end())。通过调用normalized() 方法,可以将异常时间间隔转换为正常时间间隔。
contains() 方法用于判断指定时间是否位于该时间区间内。
translated() 方法返回一个时间间隔,该时间间隔已根据指定的偏移量向前或向后转换。
另请参阅 QMediaTimeRange 。
成员函数文档
[constexpr noexcept default] Interval::Interval()
默认——构造一个Interval 的实例。
[explicit constexpr noexcept] Interval::Interval(qint64 start, qint64 end)
根据指定的start 和end 时间,构建一个时间区间。
[constexpr noexcept] bool Interval::contains(qint64 time) const
如果时间区间包含指定的time ,则返回true。也就是说,start() <= time <=end()。
[constexpr noexcept] qint64 Interval::end() const
返回该时间区间的结束时间。
另请参阅 start()。
[constexpr noexcept] bool Interval::isNormal() const
如果该时间间隔正常,则返回 true。正常的时间间隔满足start() <=end()。
另请参阅 normalized()。
[constexpr] QMediaTimeRange::Interval Interval::normalized() const
返回该时间区间的归一化版本。
如果该时间段的start()时间大于end()时间,则返回的时间段的开始时间和结束时间将互换。
[constexpr noexcept] qint64 Interval::start() const
返回该时间区间的起始时间。
另请参阅 end()。
[constexpr] QMediaTimeRange::Interval Interval::translated(qint64 offset) const
返回该时间区间的副本,并按offset 的值进行偏移。可以通过正偏移量将区间向前移动,或通过负偏移量向后移动。
相关非成员
[constexpr noexcept] bool operator!=(QMediaTimeRange::Interval lhs, QMediaTimeRange::Interval rhs)
如果 `lhs ` 与 `rhs` 不完全相等,则返回 true。
[constexpr noexcept] bool operator==(QMediaTimeRange::Interval lhs, QMediaTimeRange::Interval rhs)
如果 `lhs ` 与 `rhs` 完全相等,则返回 `true`。
© 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.