summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Spoerl <axel.spoerl@qt.io>2024-03-05 16:30:51 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-07 04:31:42 +0000
commitbadd3c8e4510455cc16f938c19af1e3fe66ce753 (patch)
tree793819f941b11c0fc5294fedfccc79b63c77b388
parent8667bba37605ff3694853983b7fa641b190ec533 (diff)
hello_speak example: Don't disable engine combo box6.6
The example disabled the QComboBox for engine selection by default, and enabled it when the default engine reported QTextToSpeech::Ready or changed its state for the first time. If the default engine failed to initialize, the default state QTextToSpeech::Error would never change. The combobox remained disabled in that case. No other engine could be chosen. Keep the combo box enabled. This amends 92cb62d6a1aca5785724d1616463da35c2fb71fc. As a drive-by, adapt copyright headers. Pick-to: 6.5 Change-Id: I651c91e1c43b43a0495873eda8640eeb03db08b7 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Jeremy Whiting <jpwhiting@kde.org> (cherry picked from commit 63810e6f7291294af88d40397c65880cf349c140) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 532ae42cfcfb41e4a509f494bb4094d8b7fdd2d3)
-rw-r--r--examples/speech/hello_speak/mainwindow.cpp6
-rw-r--r--examples/speech/hello_speak/mainwindow.h2
2 files changed, 3 insertions, 5 deletions
diff --git a/examples/speech/hello_speak/mainwindow.cpp b/examples/speech/hello_speak/mainwindow.cpp
index b60336d..b36d08a 100644
--- a/examples/speech/hello_speak/mainwindow.cpp
+++ b/examples/speech/hello_speak/mainwindow.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mainwindow.h"
@@ -70,9 +70,8 @@ void MainWindow::stateChanged(QTextToSpeech::State state)
void MainWindow::engineSelected(int index)
{
- ui.engine->setEnabled(false);
-
const QString engineName = ui.engine->itemData(index).toString();
+
delete m_speech;
m_speech = engineName == u"default"
? new QTextToSpeech(this)
@@ -89,7 +88,6 @@ void MainWindow::engineSelected(int index)
void MainWindow::onEngineReady()
{
- ui.engine->setEnabled(true);
if (m_speech->state() != QTextToSpeech::Ready) {
stateChanged(m_speech->state());
return;
diff --git a/examples/speech/hello_speak/mainwindow.h b/examples/speech/hello_speak/mainwindow.h
index 6bc26fd..734d779 100644
--- a/examples/speech/hello_speak/mainwindow.h
+++ b/examples/speech/hello_speak/mainwindow.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2017 The Qt Company Ltd.
+// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef MAINWINDOW_H