QVoice Class

The QVoice class represents a particular voice. 更多...

头: #include <QVoice>
CMake: find_package(Qt6 REQUIRED COMPONENTS TextToSpeech)
target_link_libraries(mytarget PRIVATE Qt6::TextToSpeech)
qmake: QT += texttospeech

公共类型

enum Age { Child, Teenager, Adult, Senior, Other }
enum Gender { Male, Female, Unknown }

特性

公共函数

QVoice ()
QVoice (const QVoice & other )
QVoice (QVoice && other )
~QVoice ()
QVoice::Age age () const
QVoice::Gender gender () const
QLocale::Language 语言 () const
QLocale locale () const
QString name () const
(从 6.4 起) void swap (QVoice & other )
QVoice & operator= (const QVoice & other )
QVoice & operator= (QVoice && other )

静态公共成员

QString ageName (QVoice::Age age )
QString genderName (QVoice::Gender gender )
bool operator!= (const QVoice & lhs , const QVoice & rhs )
(从 6.4 起) QDataStream & operator<< (QDataStream & stream , const QVoice & voice )
(从 6.4 起) QDebug operator<< (QDebug debug , const QVoice & voice )
bool operator== (const QVoice & lhs , const QVoice & rhs )
(从 6.4 起) QDataStream & operator>> (QDataStream & stream , QVoice & voice )

详细描述

To get a voice that is supported by the current text-to-speech engine, use QTextToSpeech::availableVoices () 或 QTextToSpeech::findVoices ().

成员类型文档编制

enum QVoice:: Age

The age of a voice.

常量 描述
QVoice::Child 0 Voice of a child
QVoice::Teenager 1 Voice of a teenager
QVoice::Adult 2 Voice of an adult
QVoice::Senior 3 Voice of a senior
QVoice::Other 4 Voice of unknown age

enum QVoice:: Gender

The gender of a voice.

常量 描述
QVoice::Male 0 Voice of a male
QVoice::Female 1 Voice of a female
QVoice::Unknown 2 Voice of unknown gender

特性文档编制

[read-only] age : const Age

This property holds the age of a voice

访问函数:

QVoice::Age age () const

[read-only] gender : const Gender

This property holds the gender of a voice

访问函数:

QVoice::Gender gender () const

[read-only, since 6.6] 语言 : const QLocale::Language

This property holds the language of the voice

This is the 语言 attribute of the voice's locale .

该特性在 Qt 6.6 引入。

访问函数:

QLocale::Language 语言 () const

[read-only, since 6.4] locale : const QLocale

This property holds the locale of the voice

The locale includes the language and the territory (i.e. accent or dialect) of the voice.

该特性在 Qt 6.4 引入。

访问函数:

QLocale locale () const

[read-only] name : const QString

This property holds the name of a voice

访问函数:

QString name () const

成员函数文档编制

QVoice:: QVoice ()

Constructs an empty QVoice.

Application code cannot construct arbitrary voice instances. Use QTextToSpeech::availableVoices () 或 QTextToSpeech::findVoices () instead to select a supported voice.

[noexcept] QVoice:: QVoice (const QVoice & other )

Copy-constructs a QVoice from other .

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

Constructs a QVoice object by moving from other .

[noexcept] QVoice:: ~QVoice ()

销毁 QVoice 实例。

[static] QString QVoice:: ageName ( QVoice::Age age )

Returns a string representing the age class of a voice.

[static] QString QVoice:: genderName ( QVoice::Gender gender )

̈́ Returns the gender name of a voice.

[noexcept, since 6.4] void QVoice:: swap ( QVoice & other )

交换 other with this voice. This operation is very fast and never fails.

该函数在 Qt 6.4 引入。

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

赋值 other 到此 QVoice 对象。

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

移动 other 到此 QVoice 对象。

相关非成员

[noexcept] bool operator!= (const QVoice & lhs , const QVoice & rhs )

Returns whether the lhs voice and the rhs voice are different.

[since 6.4] QDataStream & operator<< ( QDataStream & stream , const QVoice & voice )

Serializes voice to data stream stream .

该函数在 Qt 6.4 引入。

另请参阅 序列化 Qt 数据类型 .

[since 6.4] QDebug operator<< ( QDebug debug , const QVoice & voice )

Writes information about voice debug stream.

该函数在 Qt 6.4 引入。

另请参阅 QDebug .

[noexcept] bool operator== (const QVoice & lhs , const QVoice & rhs )

Returns whether the lhs voice and the rhs voice are identical.

Two voices are identical if name , locale , gender ,和 age are identical, and if they belong to the same text-to-speech engine.

[since 6.4] QDataStream & operator>> ( QDataStream & stream , QVoice & voice )

Deserializes voice from data stream stream .

该函数在 Qt 6.4 引入。

另请参阅 序列化 Qt 数据类型 .