PySide6.QtMultimedia.QMediaTimeRange

class QMediaTimeRange

QMediaTimeRange 类表示一组零个或多个不连续的时间间隔。More_

概要

方法

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

earliestTime()latestTime()intervals()isEmpty() 方法用于获取当前时间范围的信息。

addInterval()removeInterval()clear() 方法用于修改当前的时间范围。

在时间范围内添加或删除间隔时,可能会扩展、修剪、删除、合并或拆分范围内的现有间隔,以确保时间范围内的所有间隔保持独特且不相交。因此,从时间范围添加或删除的所有间隔必须是normal

另请参阅

Interval

__init__()

构造一个空的时间范围。

__init__(range)
Parameters:

范围QMediaTimeRange

通过复制另一个时间范围来构造一个时间范围。

__init__(interval)
Parameters:

intervalInterval

构建一个包含初始间隔的时间范围,interval

如果 interval 不是 normal,生成的时间范围将为空。

另请参阅

addInterval()

__init__(start, end)
Parameters:
  • start – int

  • end – 整数

构建一个时间范围,包含从startend的初始区间,包括两端。

如果间隔不是normal,生成的时间范围将为空。

另请参阅

addInterval()

addInterval(interval)
Parameters:

intervalInterval

将指定的interval添加到时间范围中。

添加不是normal的间隔是无效的,并且将被忽略。

如果指定的间隔与时间范围内的现有间隔相邻或重叠,这些间隔将被合并。

此操作需要线性时间。

另请参阅

removeInterval()

addInterval(start, end)
Parameters:
  • start – int

  • end – 整数

这是一个重载函数。

startend指定的间隔添加到时间范围中。

另请参阅

addInterval()

addTimeRange(range)
Parameters:

范围QMediaTimeRange

range中的每个间隔添加到此时间范围。

相当于为range中的每个间隔调用addInterval()

clear()

从时间范围中移除所有间隔。

另请参阅

removeInterval()

contains(time)
Parameters:

时间 – int

Return type:

布尔

如果指定的time在时间范围内,则返回true。

earliestTime()
Return type:

整数

返回时间范围内的最早时间。

对于空的时间范围,此值等于零。

另请参阅

latestTime()

intervals()
Return type:

QMediaTimeRange.Interval的列表

返回此时间范围覆盖的间隔列表。

isContinuous()
Return type:

布尔

如果时间范围由一个连续区间组成,则返回 true。也就是说,时间范围内有一个或更少的不连续区间。

isEmpty()
Return type:

布尔

如果时间范围内没有间隔,则返回true。

另请参阅

intervals()

latestTime()
Return type:

整数

返回时间范围内的最新时间。

对于空的时间范围,此值等于零。

另请参阅

earliestTime()

__ne__(rhs)
Parameters:

rhsQMediaTimeRange

Return type:

布尔

如果lhs中的一个或多个区间不在rhs中,则返回true。

__add__(r2)
Parameters:

r2QMediaTimeRange

Return type:

QMediaTimeRange

返回一个包含r1r2之间并集的时间范围。

__iadd__(other)
Parameters:

其他QMediaTimeRange

Return type:

QMediaTimeRange

other中的每个间隔添加到时间范围并返回结果。

__iadd__(interval)
Parameters:

intervalInterval

Return type:

QMediaTimeRange

将指定的interval添加到时间范围并返回结果。

__sub__(r2)
Parameters:

r2QMediaTimeRange

Return type:

QMediaTimeRange

返回一个时间范围,其中包含从r1中减去r2的结果。

__isub__(other)
Parameters:

其他QMediaTimeRange

Return type:

QMediaTimeRange

从时间范围中移除other中的每个间隔并返回结果。

__isub__(interval)
Parameters:

intervalInterval

Return type:

QMediaTimeRange

从时间范围中移除指定的interval并返回结果。

__eq__(rhs)
Parameters:

rhsQMediaTimeRange

Return type:

布尔

如果lhs中的所有间隔都存在于rhs中,则返回true。

removeInterval(interval)
Parameters:

intervalInterval

从时间范围中移除指定的interval

移除不是normal的间隔是无效的,并且将被忽略。

时间范围内的间隔将被修剪、分割或删除,以确保时间范围内的任何间隔都不包含目标间隔的任何部分。

此操作需要线性时间。

另请参阅

addInterval()

removeInterval(start, end)
Parameters:
  • start – int

  • end – 整数

这是一个重载函数。

从时间范围中移除由startend指定的间隔。

另请参阅

removeInterval()

removeTimeRange(range)
Parameters:

范围QMediaTimeRange

从这个时间范围中移除range中的每个间隔。

相当于为range中的每个间隔调用removeInterval()

swap(other)
Parameters:

其他QMediaTimeRange

将当前实例与other交换。

class Interval

概要

方法

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

__init__()
__init__(start, end)
Parameters:
  • start – int

  • end – 整数

使用指定的startend时间构造一个区间。

contains(time)
Parameters:

时间 – int

Return type:

布尔

如果时间间隔包含指定的time,则返回true。也就是说,start() <= time <= end()

end()
Return type:

整数

返回间隔的结束时间。

另请参阅

start()

isNormal()
Return type:

布尔

如果这个时间间隔是正常的,则返回true。一个正常的时间间隔满足 start() <= end()

另请参阅

normalized()

normalized()
Return type:

Interval

返回此区间的规范化版本。

如果间隔的start()时间大于end()时间,则返回的间隔将交换开始和结束时间。

__ne__(rhs)
Parameters:

rhsInterval

Return type:

布尔

如果 lhs 不完全等于 rhs,则返回 true。

__eq__(rhs)
Parameters:

rhsInterval

Return type:

布尔

如果 lhs 完全等于 rhs,则返回 true。

start()
Return type:

整数

返回间隔的开始时间。

另请参阅

end()

translated(offset)
Parameters:

offset – int

Return type:

Interval

返回此时间间隔的副本,通过offset值进行平移。时间间隔可以通过正偏移量向前移动,或通过负偏移量向后移动。