在本页

VoiceSelector QML Type

为选择TextToSpeech 元素的声音提供附加属性。更多

Import Statement: import QtTextToSpeech
Since: Qt 6.6

属性

方法

详细说明

该类型提供了一组默认未设置的属性。TextToSpeech 元素将选择第一个符合所有设定属性值的声音。如果找不到符合所有条件的语音,则语音不会改变。

TextToSpeech 对象初始化后设置该组中的单个属性时,必须调用select() 方法来触发语音选择。

另请参阅 TextToSpeech::voiceTextToSpeech::availableVoices()。

属性文档

age : enumerator

该属性指定所选声音应具有的age

gender : enumerator

该属性指定所选声音应具有的gender

language : locale

该属性指定所选语音应使用的语言。

该属性属于 locale 类型,但只考虑 locale 中的语言部分,地域部分将被忽略。

另请参阅 locale

locale : locale

该属性指定所选语音应具有的地域。

如果设置了该属性,则语音的语言和地域都必须匹配。

另请参阅 language

name : variant

该属性用于指定所选语音的名称。

该属性可以是字符串,也可以是正则表达式。

方法文档

void select()

根据指定的标准激活语音选择。

注: 只有在TextToSpeech 对象实例化后修改了选择标准时,才需要调用此方法。

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