summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 16:00:29 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-23 16:00:29 +0200
commitb2fdbe275f558893096356d152162df9f67cd22d (patch)
treeab94608ed14042dd3b736080431383d9cfedc6ab
parent17fc9fde48605664b24fe8508ac8192dea289557 (diff)
parent98bd3fe90bdabe24532164263dc17cb750bee8c5 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.9' into tqtc/lts-5.15-opensourcev5.15.9-lts-lgpl
-rw-r--r--.qmake.conf2
-rw-r--r--examples/speech/hello_speak/mainwindow.cpp14
-rw-r--r--examples/speech/hello_speak/mainwindow.h3
3 files changed, 16 insertions, 3 deletions
diff --git a/.qmake.conf b/.qmake.conf
index dbbbb95..6388e70 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -5,4 +5,4 @@ CONFIG += warning_clean
DEFINES += QT_NO_FOREACH
DEFINES += QT_NO_JAVA_STYLE_ITERATORS
-MODULE_VERSION = 5.15.8
+MODULE_VERSION = 5.15.9
diff --git a/examples/speech/hello_speak/mainwindow.cpp b/examples/speech/hello_speak/mainwindow.cpp
index 2a2ca62..ae383e6 100644
--- a/examples/speech/hello_speak/mainwindow.cpp
+++ b/examples/speech/hello_speak/mainwindow.cpp
@@ -103,8 +103,11 @@ void MainWindow::stateChanged(QTextToSpeech::State state)
{
if (state == QTextToSpeech::Speaking) {
ui.statusbar->showMessage("Speech started...");
- } else if (state == QTextToSpeech::Ready)
+ } else if (state == QTextToSpeech::Ready) {
ui.statusbar->showMessage("Speech stopped...", 2000);
+ if (!m_localesQueried)
+ queryLocales();
+ }
else if (state == QTextToSpeech::Paused)
ui.statusbar->showMessage("Speech paused...");
else
@@ -117,12 +120,19 @@ void MainWindow::stateChanged(QTextToSpeech::State state)
void MainWindow::engineSelected(int index)
{
+ m_localesQueried = false;
QString engineName = ui.engine->itemData(index).toString();
delete m_speech;
if (engineName == "default")
m_speech = new QTextToSpeech(this);
else
m_speech = new QTextToSpeech(engineName, this);
+
+ connect(m_speech, &QTextToSpeech::stateChanged, this, &MainWindow::stateChanged);
+}
+
+void MainWindow::queryLocales()
+{
disconnect(ui.language, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MainWindow::languageSelected);
ui.language->clear();
// Populate the languages combobox before connecting its signal.
@@ -144,11 +154,11 @@ void MainWindow::engineSelected(int index)
connect(ui.pauseButton, &QPushButton::clicked, m_speech, &QTextToSpeech::pause);
connect(ui.resumeButton, &QPushButton::clicked, m_speech, &QTextToSpeech::resume);
- connect(m_speech, &QTextToSpeech::stateChanged, this, &MainWindow::stateChanged);
connect(m_speech, &QTextToSpeech::localeChanged, this, &MainWindow::localeChanged);
connect(ui.language, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MainWindow::languageSelected);
localeChanged(current);
+ m_localesQueried = true;
}
void MainWindow::languageSelected(int language)
diff --git a/examples/speech/hello_speak/mainwindow.h b/examples/speech/hello_speak/mainwindow.h
index eef4057..d415519 100644
--- a/examples/speech/hello_speak/mainwindow.h
+++ b/examples/speech/hello_speak/mainwindow.h
@@ -65,6 +65,8 @@ class MainWindow : public QMainWindow
public:
MainWindow(QWidget *parent = 0);
+ void queryLocales();
+
public slots:
void speak();
void stop();
@@ -84,6 +86,7 @@ private:
Ui::MainWindow ui;
QTextToSpeech *m_speech;
QVector<QVoice> m_voices;
+ bool m_localesQueried;
};
#endif