Nesta página

QMediaTimeRange Class

A classe QMediaTimeRange representa um conjunto de zero ou mais intervalos de tempo não sobrepostos. Mais...

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

Observação: Todas as funções desta classe são reentrantes.

Tipos públicos

struct Interval

Funções públicas

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)

Descrição detalhada

Os métodos earliestTime(), latestTime(), intervals() e isEmpty() são usados para obter informações sobre o intervalo de tempo atual.

Os métodos addInterval(), removeInterval() e clear() são usados para modificar o intervalo de tempo atual.

Ao adicionar ou remover intervalos do intervalo de tempo, os intervalos existentes dentro desse intervalo podem ser expandidos, recortados, excluídos, mesclados ou divididos para garantir que todos os intervalos dentro do intervalo de tempo permaneçam distintos e disjuntos. Consequentemente, todos os intervalos adicionados ou removidos de um intervalo de tempo devem ser normal.

Veja também QMediaTimeRange::Interval.

Documentação das funções-membro

QMediaTimeRange::QMediaTimeRange()

Cria um intervalo de tempo vazio.

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

Cria um intervalo de tempo que contém um intervalo inicial, interval.

Se ` interval ` não for ` normal`, o intervalo de tempo resultante ficará vazio.

Veja também ` addInterval()`.

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

Cria um intervalo de tempo que contém um intervalo inicial de start a end, inclusive.

Se o intervalo não for normal, o intervalo de tempo resultante ficará vazio.

Veja também addInterval().

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

Cria um intervalo de tempo copiando outro intervalo de tempo range.

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

Cria um intervalo de tempo a partir de other.

[noexcept] QMediaTimeRange::~QMediaTimeRange()

Destrutor.

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

Adiciona o intervalo de tempo especificado interval ao intervalo de tempo.

A adição de intervalos que não sejam do tipo “ normal ” é inválida e será ignorada.

Se o intervalo especificado for adjacente a intervalos existentes no intervalo de tempo ou se sobrepor a eles, esses intervalos serão mesclados.

Essa operação leva tempo linear.

Veja também removeInterval().

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

Adiciona o intervalo especificado por start e end ao intervalo de tempo.

Esta é uma função sobrecarregada.

Veja também addInterval().

void QMediaTimeRange::addTimeRange(const QMediaTimeRange &range)

Adiciona cada um dos intervalos em range a esse intervalo de tempo.

Equivalente a chamar ` addInterval()` para cada intervalo em ` range`.

void QMediaTimeRange::clear()

Remove todos os intervalos do intervalo de tempo.

Veja também removeInterval().

bool QMediaTimeRange::contains(qint64 time) const

Retorna `true` se o ` time ` especificado estiver dentro do intervalo de tempo.

qint64 QMediaTimeRange::earliestTime() const

Retorna a hora mais cedo dentro do intervalo de tempo.

Para intervalos de tempo vazios, esse valor é igual a zero.

Veja também latestTime().

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

Retorna a lista de intervalos abrangidos por esse intervalo de tempo.

bool QMediaTimeRange::isContinuous() const

Retorna `true` se o intervalo de tempo for contínuo. Ou seja, há um ou menos intervalos não sobrepostos dentro do intervalo de tempo.

bool QMediaTimeRange::isEmpty() const

Retorna `true` se não houver intervalos dentro do intervalo de tempo.

Veja também intervals().

qint64 QMediaTimeRange::latestTime() const

Retorna a hora mais recente dentro do intervalo de tempo.

Para intervalos de tempo vazios, esse valor é igual a zero.

Veja também earliestTime().

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

Remove o intervalo de tempo especificado ( interval ) do intervalo de tempo.

A remoção de intervalos que não sejam de tipo “ normal ” é inválida e será ignorada.

Os intervalos dentro do intervalo de tempo serão recortados, divididos ou excluídos de forma que nenhum intervalo dentro desse intervalo inclua qualquer parte do intervalo alvo.

Essa operação leva tempo linear.

Veja também ` addInterval()`.

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

Remove o intervalo especificado por start e end do intervalo de tempo.

Esta é uma função sobrecarregada.

Veja também removeInterval().

void QMediaTimeRange::removeTimeRange(const QMediaTimeRange &range)

Remove cada um dos intervalos em range desse intervalo de tempo.

Equivale a chamar ` removeInterval()` para cada intervalo em ` range`.

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

Troca a instância atual pela other.

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

Adiciona cada intervalo em ` other ` ao intervalo de tempo e retorna o resultado.

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

Adiciona o ` interval ` especificado ao intervalo de tempo e retorna o resultado.

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

Remove cada intervalo em other do intervalo de tempo e retorna o resultado.

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

Remove o ` interval ` especificado do intervalo de tempo e retorna o resultado.

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

Coloca “ other ” nesse intervalo de tempo.

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

Obtém uma cópia do intervalo de tempo ` other ` e retorna a si mesmo.

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

Define o intervalo de tempo como um único intervalo contínuo: interval.

Não-membros relacionados

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

Retorna `true` se um ou mais intervalos em ` lhs ` não estiverem presentes em ` rhs`.

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

Retorna um intervalo de tempo que contém a união entre r1 e r2.

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

Retorna um intervalo de tempo que contém r2 subtraído de r1.

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

Retorna `true` se todos os intervalos em ` lhs ` estiverem presentes em ` rhs`.

© 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.