PySide6.QtTextToSpeech.QVoice

class QVoice

QVoice 类代表一个特定的语音。更多

概要

属性

方法

静态函数

注意

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

详细描述

要获取当前文本转语音引擎支持的声音,请使用 availableVoices()findVoices()

class Gender

语音的性别。

常量

描述

QVoice.Male

男性声音

QVoice.Female

女性的声音

QVoice.Unknown

未知性别的语音

class Age

声音的年龄。

常量

描述

QVoice.Child

儿童的声音

QVoice.Teenager

青少年的声音

QVoice.Adult

成年人的声音

QVoice.Senior

高级语音

QVoice.Other

未知年龄的声音

注意

当使用from __feature__ import true_property时,属性可以直接使用,否则通过访问器函数使用。

property ageᅟ: QVoice.Age

此属性保存语音的年龄。

Access functions:
property genderᅟ: QVoice.Gender

此属性保存语音的性别。

Access functions:
property languageᅟ: QLocale.Language

此属性保存语音的语言。

这是语音的locale的语言属性。

Access functions:
property localeᅟ: QLocale

此属性保存语音的区域设置。

区域设置包括语音的语言和地区(即口音或方言)。

Access functions:
property nameᅟ: str

此属性保存语音的名称。

Access functions:
__init__()

构造一个空的 QVoice

应用程序代码无法构造任意的语音实例。请使用availableVoices()findVoices()来选择支持的语音。

__init__(other)
Parameters:

其他QVoice

other 复制构造一个 QVoice

age()
Return type:

年龄

属性 ageᅟ 的获取器。

static ageName(age)
Parameters:

年龄Age

Return type:

字符串

返回表示语音的age类的字符串。

gender()
Return type:

性别

获取属性 genderᅟ 的Getter。

static genderName(gender)
Parameters:

性别Gender

Return type:

字符串

返回语音的gender名称。

language()
Return type:

语言

属性 languageᅟ 的获取器。

locale()
Return type:

QLocale

属性 localeᅟ 的获取器。

name()
Return type:

字符串

获取属性 nameᅟ 的Getter。

__ne__(rhs)
Parameters:

rhsQVoice

Return type:

布尔

返回lhs语音和rhs语音是否不同。

__eq__(rhs)
Parameters:

rhsQVoice

Return type:

布尔

返回lhs语音和rhs语音是否相同。

如果namelocalegenderage相同,并且它们属于同一个文本到语音引擎,则两个声音是相同的。

swap(other)
Parameters:

其他QVoice

将此语音与other交换。此操作非常快速且永远不会失败。