/* SPDX-FileCopyrightText: 2024 Evgeny Chesnokov SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include class KeyboardSettings; class XkbOptionsModel final : public QAbstractItemModel { Q_OBJECT enum Roles { CheckedRole = Qt::UserRole + 1, NameRole, DescriptionRole, TypeRole, }; public: XkbOptionsModel(QObject *parent); void setXkbOptions(const QStringList &options); QStringList xkbOptions() const; int columnCount(const QModelIndex &) const override; int rowCount(const QModelIndex &parent) const override; QModelIndex parent(const QModelIndex &index) const override; QModelIndex index(int row, int column, const QModelIndex &parent) const override; QHash roleNames() const override; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; QVariant data(const QModelIndex &index, int role) const override; void reset(); Q_INVOKABLE QString getShortcutName(const QString &group); Q_INVOKABLE void clearXkbGroup(const QString &group); Q_INVOKABLE void navigateToGroup(const QString &group); void populateWithCurrentXkbOptions(); Q_SIGNALS: void navigateTo(const QModelIndex &index); private: QStringList m_xkbOptions; };