QVoice Class
QVoice 类代表一个特定的语音。更多
头文件: | #include <QVoice> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS TextToSpeech) target_link_libraries(mytarget PRIVATE Qt6::TextToSpeech) |
qmake: | QT += texttospeech |
公共类型
属性
公共函数
QVoice() | |
QVoice(const QVoice &other) | |
QVoice(QVoice &&other) | |
~QVoice() | |
QVoice::Age | age() const |
QVoice::Gender | gender() const |
QLocale::Language | language() const |
QLocale | locale() const |
QString | name() const |
(since 6.4) void | swap(QVoice &other) |
QVoice & | operator=(QVoice &&other) |
QVoice & | operator=(const QVoice &other) |
静态公共成员
QString | ageName(QVoice::Age age) |
QString | genderName(QVoice::Gender gender) |
相关非成员
bool | operator!=(const QVoice &lhs, const QVoice &rhs) |
(since 6.4) QDataStream & | operator<<(QDataStream &stream, const QVoice &voice) |
(since 6.4) QDebug | operator<<(QDebug debug, const QVoice &voice) |
bool | operator==(const QVoice &lhs, const QVoice &rhs) |
(since 6.4) QDataStream & | operator>>(QDataStream &stream, QVoice &voice) |
详细说明
要获取当前文本到语音引擎支持的语音,请使用QTextToSpeech::availableVoices() 或QTextToSpeech::findVoices() 。
成员类型文档
enum QVoice::Age
声音的时代
恒定 | 值 | 说明 |
---|---|---|
QVoice::Child | 0 | 儿童的声音 |
QVoice::Teenager | 1 | 青少年的声音 |
QVoice::Adult | 2 | 成人的声音 |
QVoice::Senior | 3 | 老年人的声音 |
QVoice::Other | 4 | 未知年龄的声音 |
enum QVoice::Gender
声音的性别
常数 | 值 | 说明 |
---|---|---|
QVoice::Male | 0 | 男声 |
QVoice::Female | 1 | 女声 |
QVoice::Unknown | 2 | 性别未知的声音 |
属性文件
[read-only]
age : const Age
该属性保存语音的年龄
访问功能:
QVoice::Age | age() const |
[read-only]
gender : const Gender
该属性用于保存语音的性别
访问功能
QVoice::Gender | gender() const |
[read-only, since 6.6]
language : const QLocale::Language
该属性包含语音的语言
该属性在 Qt 6.6 中引入。
访问功能:
QLocale::Language | language() const |
[read-only, since 6.4]
locale : const QLocale
该属性包含语音的地域
locale 包括语音的语言和地域(即口音或方言)。
该属性在 Qt 6.4 中引入。
访问函数:
QLocale | locale() const |
[read-only]
name : const QString
该属性用于保存语音名称
访问功能:
QString | name() const |
成员函数文档
QVoice::QVoice()
构造一个空 QVoice。
应用程序代码不能构建任意语音实例。请使用QTextToSpeech::availableVoices() 或QTextToSpeech::findVoices() 选择支持的语音。
[noexcept]
QVoice::QVoice(const QVoice &other)
从other 复制-构建 QVoice。
[noexcept]
QVoice::QVoice(QVoice &&other)
从other 开始构建 QVoice 对象。
[noexcept]
QVoice::~QVoice()
销毁QVoice 实例。
[static]
QString QVoice::ageName(QVoice::Age age)
返回表示语音age 类别的字符串。
[static]
QString QVoice::genderName(QVoice::Gender gender)
̈́ 返回gender 语音名称。
[noexcept, since 6.4]
void QVoice::swap(QVoice &other)
与该语音交换other 。该操作速度非常快,而且从不出错。
此功能在 Qt 6.4 中引入。
[noexcept]
QVoice &QVoice::operator=(QVoice &&other)
将other 移入此QVoice 对象。
[noexcept]
QVoice &QVoice::operator=(const QVoice &other)
为QVoice 对象指定other 。
相关非会员
[noexcept]
bool operator!=(const QVoice &lhs, const QVoice &rhs)
返回lhs 声音和rhs 声音是否不同。
[since 6.4]
QDataStream &operator<<(QDataStream &stream, const QVoice &voice)
将voice 序列化为数据流stream 。
此函数在 Qt 6.4 中引入。
另请参阅 序列化 Qt 数据类型。
[since 6.4]
QDebug operator<<(QDebug debug, const QVoice &voice)
将有关voice 的信息写入debug 流。
此函数在 Qt 6.4 中引入。
另请参阅 QDebug 。
[noexcept]
bool operator==(const QVoice &lhs, const QVoice &rhs)
返回lhs 语音和rhs 语音是否相同。
如果name,locale,gender, 和age 相同,并且属于同一个文本到语音引擎,则这两个语音是相同的。
[since 6.4]
QDataStream &operator>>(QDataStream &stream, QVoice &voice)
从数据流stream 反序列化voice 。
该函数在 Qt 6.4 中引入。
另请参阅 序列化 Qt 数据类型。
© 2025 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.