QMediaTimeRange 類

QMediaTimeRange 類錶示一組零個或多個不相交的時間間隔。 更多...

頭: #include <QMediaTimeRange>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia

注意: 此類的所有函數 可重入 .

公共類型

struct Interval

公共函數

QMediaTimeRange ()
QMediaTimeRange (const QMediaTimeRange::Interval & interval )
QMediaTimeRange (qint64 start , qint64 end )
QMediaTimeRange (const QMediaTimeRange & range )
QMediaTimeRange (QMediaTimeRange && other )
~QMediaTimeRange ()
void addInterval (const QMediaTimeRange::Interval & interval )
void addInterval (qint64 start , qint64 end )
void addTimeRange (const QMediaTimeRange & range )
void clear ()
bool contains (qint64 time ) const
qint64 earliestTime () const
QList<QMediaTimeRange::Interval> intervals () const
bool isContinuous () const
bool isEmpty () const
qint64 latestTime () const
void removeInterval (const QMediaTimeRange::Interval & interval )
void removeInterval (qint64 start , qint64 end )
void removeTimeRange (const QMediaTimeRange & range )
void swap (QMediaTimeRange & other )
QMediaTimeRange & operator+= (const QMediaTimeRange & other )
QMediaTimeRange & operator+= (const QMediaTimeRange::Interval & interval )
QMediaTimeRange & operator-= (const QMediaTimeRange & other )
QMediaTimeRange & operator-= (const QMediaTimeRange::Interval & interval )
QMediaTimeRange & operator= (QMediaTimeRange && other )
QMediaTimeRange & operator= (const QMediaTimeRange & other )
QMediaTimeRange & operator= (const QMediaTimeRange::Interval & interval )
bool operator!= (const QMediaTimeRange & lhs , const QMediaTimeRange & rhs )
QMediaTimeRange operator+ (const QMediaTimeRange & r1 , const QMediaTimeRange & r2 )
QMediaTimeRange operator- (const QMediaTimeRange & r1 , const QMediaTimeRange & r2 )
bool operator== (const QMediaTimeRange & lhs , const QMediaTimeRange & rhs )

詳細描述

The earliestTime (), latestTime (), intervals () 和 isEmpty () methods are used to get information about the current time range.

The addInterval (), removeInterval () 和 clear () methods are used to modify the current time range.

When adding or removing intervals from the time range, existing intervals within the range may be expanded, trimmed, deleted, merged or split to ensure that all intervals within the time range remain distinct and disjoint. As a consequence, all intervals added or removed from a time range must be normal .

另請參閱 QMediaTimeRange::Interval .

成員函數文檔編製

QMediaTimeRange:: QMediaTimeRange ()

Constructs an empty time range.

QMediaTimeRange:: QMediaTimeRange (const QMediaTimeRange::Interval & interval )

Constructs a time range that contains an initial interval, interval .

interval 不是 normal , the resulting time range will be empty.

另請參閱 addInterval ().

[explicit] QMediaTimeRange:: QMediaTimeRange ( qint64 start , qint64 end )

Constructs a time range that contains an initial interval from start to end 包括在內。

If the interval is not normal , the resulting time range will be empty.

另請參閱 addInterval ().

[noexcept] QMediaTimeRange:: QMediaTimeRange (const QMediaTimeRange & range )

Constructs a time range by copying another time range .

[noexcept] QMediaTimeRange:: QMediaTimeRange ( QMediaTimeRange && other )

Constructs a time range by moving from other .

[noexcept] QMediaTimeRange:: ~QMediaTimeRange ()

析構函數。

void QMediaTimeRange:: addInterval (const QMediaTimeRange::Interval & interval )

Adds the specified interval to the time range.

Adding intervals which are not normal is invalid, and will be ignored.

If the specified interval is adjacent to, or overlaps existing intervals within the time range, these intervals will be merged.

This operation takes linear time.

另請參閱 removeInterval ().

void QMediaTimeRange:: addInterval ( qint64 start , qint64 end )

這是重載函數。

Adds the interval specified by start and end to the time range.

另請參閱 addInterval ().

void QMediaTimeRange:: addTimeRange (const QMediaTimeRange & range )

Adds each of the intervals in range to this time range.

相當於調用 addInterval () for each interval in range .

void QMediaTimeRange:: clear ()

Removes all intervals from the time range.

另請參閱 removeInterval ().

bool QMediaTimeRange:: contains ( qint64 time ) const

返迴 true 若指定 time lies within the time range.

qint64 QMediaTimeRange:: earliestTime () const

Returns the earliest time within the time range.

For empty time ranges, this value is equal to zero.

另請參閱 latestTime ().

QList < QMediaTimeRange::Interval > QMediaTimeRange:: intervals () const

Returns the list of intervals covered by this time range.

bool QMediaTimeRange:: isContinuous () const

Returns true if the time range consists of a continuous interval. That is, there is one or fewer disjoint intervals within the time range.

bool QMediaTimeRange:: isEmpty () const

Returns true if there are no intervals within the time range.

另請參閱 intervals ().

qint64 QMediaTimeRange:: latestTime () const

Returns the latest time within the time range.

For empty time ranges, this value is equal to zero.

另請參閱 earliestTime ().

void QMediaTimeRange:: removeInterval (const QMediaTimeRange::Interval & interval )

移除指定 interval from the time range.

Removing intervals which are not normal is invalid, and will be ignored.

Intervals within the time range will be trimmed, split or deleted such that no intervals within the time range include any part of the target interval.

This operation takes linear time.

另請參閱 addInterval ().

void QMediaTimeRange:: removeInterval ( qint64 start , qint64 end )

這是重載函數。

Removes the interval specified by start and end from the time range.

另請參閱 removeInterval ().

void QMediaTimeRange:: removeTimeRange (const QMediaTimeRange & range )

Removes each of the intervals in range from this time range.

相當於調用 removeInterval () for each interval in range .

[noexcept] void QMediaTimeRange:: swap ( QMediaTimeRange & other )

Swaps the current instance with the other .

QMediaTimeRange &QMediaTimeRange:: operator+= (const QMediaTimeRange & other )

Adds each interval in other to the time range and returns the result.

QMediaTimeRange &QMediaTimeRange:: operator+= (const QMediaTimeRange::Interval & interval )

Adds the specified interval to the time range and returns the result.

QMediaTimeRange &QMediaTimeRange:: operator-= (const QMediaTimeRange & other )

Removes each interval in other from the time range and returns the result.

QMediaTimeRange &QMediaTimeRange:: operator-= (const QMediaTimeRange::Interval & interval )

移除指定 interval from the time range and returns the result.

[noexcept] QMediaTimeRange &QMediaTimeRange:: operator= ( QMediaTimeRange && other )

移動 other into this time range.

[noexcept] QMediaTimeRange &QMediaTimeRange:: operator= (const QMediaTimeRange & other )

Takes a copy of the other time range and returns itself.

QMediaTimeRange &QMediaTimeRange:: operator= (const QMediaTimeRange::Interval & interval )

Sets the time range to a single continuous interval, interval .

相關非成員

bool operator!= (const QMediaTimeRange & lhs , const QMediaTimeRange & rhs )

Returns true if one or more intervals in lhs are not present in rhs .

QMediaTimeRange operator+ (const QMediaTimeRange & r1 , const QMediaTimeRange & r2 )

Returns a time range containing the union between r1 and r2 .

QMediaTimeRange operator- (const QMediaTimeRange & r1 , const QMediaTimeRange & r2 )

Returns a time range containing r2 減去 r1 .

bool operator== (const QMediaTimeRange & lhs , const QMediaTimeRange & rhs )

Returns true if all intervals in lhs are present in rhs .