File indexing completed on 2024-10-06 13:19:04
0001 /* 0002 SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "hotkeys_proxy_model.h" 0008 #include "hotkeys_model.h" 0009 0010 struct KHotkeysProxyModelPrivate { 0011 KHotkeysProxyModelPrivate(KHotkeysProxyModel *host); 0012 0013 //! Our host 0014 KHotkeysProxyModel *q; 0015 0016 }; // class KHotkeysProxyModelPrivate 0017 0018 KHotkeysProxyModelPrivate::KHotkeysProxyModelPrivate(KHotkeysProxyModel *host) 0019 : q(host) 0020 { 0021 } 0022 0023 KHotkeysProxyModel::KHotkeysProxyModel(QObject *parent) 0024 : QSortFilterProxyModel(parent) 0025 , d(new KHotkeysProxyModelPrivate(this)) 0026 { 0027 } 0028 0029 KHotkeysProxyModel::~KHotkeysProxyModel() 0030 { 0031 delete d; 0032 d = 0; 0033 } 0034 0035 bool KHotkeysProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const 0036 { 0037 Q_UNUSED(source_row); 0038 Q_UNUSED(source_parent); 0039 return true; 0040 } 0041 0042 // Convert index to ActionDataBase 0043 KHotKeys::ActionDataBase *KHotkeysProxyModel::indexToActionDataBase(const QModelIndex &index) const 0044 { 0045 return sourceModel()->indexToActionDataBase(mapToSource(index)); 0046 } 0047 0048 // Convert index to ActionDataGroup 0049 KHotKeys::ActionDataGroup *KHotkeysProxyModel::indexToActionDataGroup(const QModelIndex &index) const 0050 { 0051 return sourceModel()->indexToActionDataGroup(mapToSource(index)); 0052 } 0053 0054 // Return the source model 0055 KHotkeysModel *KHotkeysProxyModel::sourceModel() const 0056 { 0057 return static_cast<KHotkeysModel *>(QSortFilterProxyModel::sourceModel()); 0058 } 0059 0060 #include "moc_hotkeys_proxy_model.cpp"