IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Changes to Qt TextToSpeech

Migrate Qt TextToSpeech to Qt 6.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Changes to Qt TextToSpeech

Qt 6 is a result of the conscious effort to make the framework more efficient and easy to use.

We try to maintain binary and source compatibility for all the public APIs in each release. But some changes were inevitable in an effort to make Qt a better framework.

In this topic we summarize those changes in Qt TextToSpeech, and provide guidance to handle them.

Available Engines

All engines that were available in Qt 5 are also available in Qt 6.4. For a complete list of available engines in Qt 6.4, see Qt TextToSpeech Engines.

Engines can now receive additional configuration parameters. When constructing a QTextToSpeech instance, pass a QVariantMap with engine-specific key/value pairs.

API changes

The Qt TextToSpeech module has undergone some basic consolidation and cleanup. There should be minimal porting effort to be able to switch to Qt6.

The QTextToSpeech class

The QTextToSpeech::State enum value BackendError has been renamed to Error. Detailed error information is available via QTextToSpeech::errorReason() and QTextToSpeech::errorString().

The new engine property allows changing of the engine on an initialized QTextToSpeech object.

The pause and QTextToSpeech::stop slots take a QTextToSpeech::BoundaryHint enum value. This will break the compilation for signal/slot connections that use PMF syntax if the signal has parameters that were previously ignored:

 
Sélectionnez
connect(stopButton, &QPushButton, tts, &QTextToSpeech::stop);

Either connect to a signal without parameters, or use a lambda and call the respective slot method explicitly:

 
Sélectionnez
connect(stopButton, &QPushButton, tts, [tts]{ tts->stop(); });

The QVoice class

Existing code using the QVoice class continues to work as before. QVoice objects can now be serialized via QDataStream.

The QTextToSpeechEngine and QTextToSpeechPlugin classes

These classes have been removed from the public API. They still exist and are used by the available engine implementations, but they are not part of the documented and supported API, and are likely to change in future releases.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+