1 #include <stdexcept>
2 #include "AddressableItemModel.h"
3 
4 #include <stdexcept>
5 
AddressableFilterProxyModel(AddressableItemModelI * sourceModel,QObject * parent)6 AddressableFilterProxyModel::AddressableFilterProxyModel(AddressableItemModelI *sourceModel,
7                                                          QObject *parent) :
8     AddressableItemModel<QSortFilterProxyModel>(parent)
9 {
10     setSourceModel(sourceModel);
11     addressableSourceModel = sourceModel;
12 }
13 
address(const QModelIndex & index) const14 RVA AddressableFilterProxyModel::address(const QModelIndex &index) const
15 {
16     return addressableSourceModel->address(this->mapToSource(index));
17 }
18 
name(const QModelIndex & index) const19 QString AddressableFilterProxyModel::name(const QModelIndex &index) const
20 {
21     return addressableSourceModel->name(this->mapToSource(index));
22 }
23 
setSourceModel(QAbstractItemModel *)24 void AddressableFilterProxyModel::setSourceModel(QAbstractItemModel *)
25 {
26     throw new std::runtime_error("Not supported");
27 }
28 
setSourceModel(AddressableItemModelI * sourceModel)29 void AddressableFilterProxyModel::setSourceModel(AddressableItemModelI *sourceModel)
30 {
31     ParentClass::setSourceModel(sourceModel->asItemModel());
32     addressableSourceModel = sourceModel;
33 }
34