diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-08-30 08:55:39 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-30 09:10:04 +0000 |
commit | f4eab44d368a23602d0e77dc4dfd8b58ea54cc94 (patch) | |
tree | 3b11314d8ba1e186bb0df0451927d4b110ab8a20 | |
parent | 88e6028a22a4631dc2eb77702a40c8a26f0945b1 (diff) |
Fix QML type registration and documentation of Voice
Voice is a value type, so should start with a lower-case letter in QML.
The type doesn't need to be registered as it's not creatable, so the
warning from the QLM registration system showed. Register it explicitly
now, and fix the QML documentation.
And to make the enumerators in QVoice available to the QML engine,
register the Voice namespace in addition. Otherwise we cannot compare to
e.g. Voice.Female in QML code.
Change-Id: I70ebef5a167e107d15df1e29f8514465efe5d54b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 802f2fdf4000bcab979666dd279688a0c23eb28c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/tts/qtexttospeech.cpp | 2 | ||||
-rw-r--r-- | src/tts/qtexttospeech_qmltypes_p.h | 14 | ||||
-rw-r--r-- | src/tts/qvoice.cpp | 8 |
3 files changed, 19 insertions, 5 deletions
diff --git a/src/tts/qtexttospeech.cpp b/src/tts/qtexttospeech.cpp index 86906aa..842b0b2 100644 --- a/src/tts/qtexttospeech.cpp +++ b/src/tts/qtexttospeech.cpp @@ -161,7 +161,7 @@ void QTextToSpeechPrivate::loadPluginMetadata(QMultiHash<QString, QCborMap> &lis to control the reading of the text. It is possible to specify the language with \l locale. To set a \l voice, get the - list of \l availableVoices() and set the desired \l Voice. The list of available + list of \l availableVoices() and set the desired \l voice. The list of available voices depends on the active locale on most platforms. */ diff --git a/src/tts/qtexttospeech_qmltypes_p.h b/src/tts/qtexttospeech_qmltypes_p.h index 9e9e518..e7eb685 100644 --- a/src/tts/qtexttospeech_qmltypes_p.h +++ b/src/tts/qtexttospeech_qmltypes_p.h @@ -27,6 +27,20 @@ struct QTextToSpeechForeign QML_NAMED_ELEMENT(TextToSpeech) }; +struct QVoiceForeign +{ + Q_GADGET + QML_FOREIGN(QVoice) + QML_NAMED_ELEMENT(voice) +}; + +namespace QVoiceForeignNamespace +{ + Q_NAMESPACE + QML_FOREIGN_NAMESPACE(QVoice) + QML_NAMED_ELEMENT(Voice) +} + QT_END_NAMESPACE #endif // QTTEXTTOSPEECHTYPES_H diff --git a/src/tts/qvoice.cpp b/src/tts/qvoice.cpp index 6ae15dc..d89f6e7 100644 --- a/src/tts/qvoice.cpp +++ b/src/tts/qvoice.cpp @@ -21,9 +21,9 @@ QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QVoicePrivate) */ /*! - \qmltype Voice + \qmltype voice \inqmlmodule QtTextToSpeech - \brief The Voice type represents a particular voice. + \brief The voice type represents a particular voice. To get a voice that is supported by the current text-to-speech engine, use \l TextToSpeech::availableVoices(). @@ -174,7 +174,7 @@ QString QVoice::name() const } /*! - \qmlproperty locale Voice::locale + \qmlproperty locale voice::locale \brief This property holds the locale of the voice. The locale includes the language and the territory (i.e. accent or dialect) @@ -195,7 +195,7 @@ QLocale QVoice::locale() const } /*! - \qmlproperty enumeration Voice::gender + \qmlproperty enumeration voice::gender \brief This property holds the gender of the voice. \sa QVoice::Gender |