KTextAddons

autocorrectionlanguagemodel.h
1/*
2 SPDX-FileCopyrightText: 2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QAbstractListModel>
10namespace TextAutoCorrectionWidgets
11{
12class AutoCorrectionLanguageModel : public QAbstractListModel
13{
15public:
16 enum AutoCorrectionLanguageModelRoles {
17 LocaleI18n = Qt::UserRole + 1,
18 Locale,
19 };
20 Q_ENUM(AutoCorrectionLanguageModelRoles)
21
22 explicit AutoCorrectionLanguageModel(QObject *parent = nullptr);
23 ~AutoCorrectionLanguageModel() override;
24
25 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
26 [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
27
28 [[nodiscard]] QString language(int index) const;
29
30private:
31 struct LocaleInfo {
32 QString localeTranslated;
33 QString localeCode;
34 };
35 void fillModel();
36
37 QList<LocaleInfo> mLocalInfos;
38};
39}
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
Q_ENUM(...)
Q_OBJECTQ_OBJECT
QObject * parent() const const
UserRole
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.