File indexing completed on 2024-09-15 10:32:55
0001 /* 0002 SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #ifndef KHOTKEYSPROXYMODEL_H 0007 #define KHOTKEYSPROXYMODEL_H 0008 0009 #include "libkhotkeysfwd.h" 0010 0011 #include <QSortFilterProxyModel> 0012 0013 class KHotkeysProxyModelPrivate; 0014 class KHotkeysModel; 0015 0016 /** 0017 * @author Michael Jansen <kde@michael-jansen.biz> 0018 */ 0019 class KHotkeysProxyModel : public QSortFilterProxyModel 0020 { 0021 Q_OBJECT 0022 0023 public: 0024 /** 0025 * Default constructor 0026 */ 0027 KHotkeysProxyModel(QObject *parent); 0028 0029 /** 0030 * Destructor 0031 */ 0032 ~KHotkeysProxyModel() override; 0033 0034 /** 0035 * Returns true if the item in column @a column should be included in 0036 * the model. 0037 */ 0038 bool filterAcceptsRow(int source_column, const QModelIndex &source_parent) const override; 0039 0040 /** 0041 * Get the KHotKeys::ActionDataBase behind the index. 0042 */ 0043 KHotKeys::ActionDataBase *indexToActionDataBase(const QModelIndex &index) const; 0044 0045 /** 0046 * Get the KHotKeys::ActionDataBase behind the index or 0. 0047 * 0048 * Getting 0 doesn't mean the index is invalid. It means you provided a 0049 * action object. 0050 */ 0051 KHotKeys::ActionDataGroup *indexToActionDataGroup(const QModelIndex &index) const; 0052 0053 /** 0054 * Return the source model. Casted to the correct class. 0055 */ 0056 KHotkeysModel *sourceModel() const; 0057 0058 private: 0059 //! Implementation details 0060 KHotkeysProxyModelPrivate *d; 0061 }; 0062 0063 #endif /* #ifndef KHOTKEYSPROXYMODEL_HPP */