File indexing completed on 2024-12-15 03:45:01
0001 /* 0002 SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: MIT 0005 */ 0006 0007 #ifndef KUSERFEEDBACK_CONSOLE_ROLEMAPPINGPROXYMODEL_H 0008 #define KUSERFEEDBACK_CONSOLE_ROLEMAPPINGPROXYMODEL_H 0009 0010 #include <QIdentityProxyModel> 0011 #include <QHash> 0012 0013 namespace KUserFeedback { 0014 namespace Console { 0015 0016 /** Proxy model to change roles. */ 0017 class RoleMappingProxyModel : public QIdentityProxyModel 0018 { 0019 Q_OBJECT 0020 public: 0021 explicit RoleMappingProxyModel(QObject *parent = nullptr); 0022 ~RoleMappingProxyModel() override; 0023 0024 void addRoleMapping(int fromRole, int toRole); 0025 0026 QVariant data(const QModelIndex & index, int role) const override; 0027 0028 private: 0029 QHash<int, int> m_roleMapping; 0030 }; 0031 0032 }} 0033 0034 #endif // KUSERFEEDBACK_CONSOLE_ROLEMAPPINGPROXYMODEL_H