MauiKit Image Tools

OCRLanguageModel.h
1/**
2 * SPDX-FileCopyrightText: 2022 by Alexander Stippich <a.stippich@gmx.net>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5 */
6
7#pragma once
8
9#include <QAbstractListModel>
10
12 QString name;
13 QString code;
14 bool use;
15};
16
17class OCRLanguageModel : public QAbstractListModel
18{
20
21public:
22
23 enum LanguageModelRoles {
24 NameRole = Qt::UserRole + 1,
25 CodeRole,
26 UseRole
27 };
28
29 explicit OCRLanguageModel(QObject *parent = nullptr);
30
31 ~OCRLanguageModel();
32
33 QHash<int, QByteArray> roleNames() const override;
34
35 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
36
37 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
38
39 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
40
41 void setLanguages(const std::vector<std::string> &availableLanguages);
42
43 std::string getLanguagesString() const;
44
45private:
46 QList<LanguageItem> m_languages;
47};
48
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
Q_OBJECTQ_OBJECT
QObject * parent() const const
UserRole
SPDX-FileCopyrightText: 2022 by Alexander Stippich a.stippich@gmx.net
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.