このページでは

QVoice Class

QVoice クラスは、特定の音声を表します。詳細...

ヘッダー: #include <QVoice>
CMake: find_package(Qt6 REQUIRED COMPONENTS TextToSpeech)
target_link_libraries(mytarget PRIVATE Qt6::TextToSpeech)
qmake: QT += texttospeech

パブリック型

enum Age { Child, Teenager, Adult, Senior, Other }
enum Gender { Male, Female, Unknown }

プロパティ

  • (since 6.4) locale : const QLocale
  • name : const QString

パブリック関数

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::Child0子供の声
QVoice::Teenager1十代の声
QVoice::Adult2大人の声
QVoice::Senior3高齢者の声
QVoice::Other4年齢不明の声

enum QVoice::Gender

声の性別。

定数値説明
QVoice::Male0男性の声
QVoice::Female1女性の声
QVoice::Unknown2性別不明の声

プロパティのドキュメント

[read-only] age : const Age

このプロパティは、声の年齢を表します

アクセス機能:

QVoice::Age age() const

[read-only] gender : const Gender

このプロパティは、音声の性別を保持します

アクセス関数:

QVoice::Gender gender() const

[read-only, since 6.6] language : QLocale::Language

このプロパティは、そのボイスの言語を保持します

これは、ボイス(voice)のlocale のlanguage 属性です。

この列挙型はQt 6.6で導入されました。

アクセス関数:

QLocale::Language language() const

[read-only, since 6.4] locale : const QLocale

このプロパティには、音声のロケールが格納されます

ロケールには、音声の言語および地域(つまり、アクセントや方言)が含まれます。

この列挙型は Qt 6.4 で導入されました。

アクセス関数:

QLocale locale() const

[read-only] name : const QString

このプロパティには、ボイスの名前が格納されます

Access 関数:

QString name() const

メンバー関数のドキュメント

QVoice::QVoice()

空の QVoice を生成します。

アプリケーションコードでは、任意の音声インスタンスを作成することはできません。代わりに、QTextToSpeech::availableVoices() またはQTextToSpeech::findVoices() を使用して、サポートされている音声を選択してください。

[noexcept] QVoice::QVoice(const QVoice &other)

other から QVoice をコピーして生成します。

[constexpr noexcept default] 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 ボイスが同一であるかどうかを返します。

2つのボイスは、name 、locale 、gender 、およびage が同一であり、かつ同じテキスト読み上げエンジンに属している場合に、同一であるとみなされます。

[since 6.4] QDataStream &operator>>(QDataStream &stream, QVoice &voice)

データストリーム `stream` から `voice ` をデシリアライズします。

この関数は Qt 6.4 で導入されました。

「Qt データ型のシリアライズ」も参照してください 。

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