KTextAddons

texttospeechlanguagecombobox.cpp
1/*
2 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "texttospeechlanguagecombobox.h"
8using namespace TextEditTextToSpeech;
9
10TextToSpeechLanguageComboBox::TextToSpeechLanguageComboBox(QWidget *parent)
11 : QComboBox(parent)
12{
13}
14
15TextToSpeechLanguageComboBox::~TextToSpeechLanguageComboBox() = default;
16
17void TextToSpeechLanguageComboBox::selectLocaleName(const QString &localeName)
18{
19 const int countItem(count());
20 for (int i = 0; i < countItem; ++i) {
21 if (itemData(i).toLocale().name() == localeName) {
23 break;
24 }
25 }
26}
27
28void TextToSpeechLanguageComboBox::updateAvailableLocales(const QVector<QLocale> &locales, const QLocale &current)
29{
30 clear();
31 for (const QLocale &locale : locales) {
32 const QVariant localeVariant(locale);
33 addItem(QLocale::languageToString(locale.language()), localeVariant);
34 if (locale.name() == current.name()) {
36 }
37 }
39 // Sort it after loading list.
41}
42
43#include "moc_texttospeechlanguagecombobox.cpp"
QString name(GameStandardAction id)
virtual void sort(int column, Qt::SortOrder order)
void addItem(const QIcon &icon, const QString &text, const QVariant &userData)
void clear()
void setCurrentIndex(int index)
QVariant itemData(int index, int role) const const
QAbstractItemModel * model() const const
void setSizeAdjustPolicy(SizeAdjustPolicy policy)
QString languageToString(Language language)
QString name() const const
AscendingOrder
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.