本页内容

VoiceSelector QML Type

提供用于选择TextToSpeech 元素语音的附加属性。更多...

Import Statement: import QtTextToSpeech
Since: Qt 6.6

属性

方法

详细说明

该类型提供了一组默认未设置的属性。TextToSpeech 元素将选择第一个满足所有已设置属性值的语音。如果找不到满足所有条件的语音,则语音保持不变。

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

另请参阅 TextToSpeech::voice 和TextToSpeech::availableVoices()。

属性文档

age : enumerator

此属性指定所选语音应具有哪种age 。

gender : enumerator

此属性指定所选语音应采用哪种gender 。

language : 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.