mirror of
https://invent.kde.org/plasma/plasma-desktop.git
synced 2026-11-03 22:59:45 -09:00
Mostly straight-forward, but touches the KCM code a bit to drop calling functions that return empty on Wayland anyway
48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2024 Evgeny Chesnokov <echesnokov@astralinux.ru>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <QAbstractItemModel>
|
|
|
|
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<int, QByteArray> 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);
|
|
|
|
Q_SIGNALS:
|
|
void navigateTo(const QModelIndex &index);
|
|
|
|
private:
|
|
QStringList m_xkbOptions;
|
|
};
|