LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
flattenfiltermodel.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <QAbstractItemModel>
12 #include "modelsconfig.h"
13 
14 namespace LC::Util
15 {
27  class UTIL_MODELS_API FlattenFilterModel : public QAbstractItemModel
28  {
29  protected:
30  QAbstractItemModel *Source_ = nullptr;
31  QList<QPersistentModelIndex> SourceIndexes_;
32  public:
37  using QAbstractItemModel::QAbstractItemModel;
38 
41  QModelIndex index (int, int, const QModelIndex& = {}) const override;
42 
45  QModelIndex parent (const QModelIndex&) const override;
46 
49  int rowCount (const QModelIndex& parent = {}) const override;
50 
53  int columnCount (const QModelIndex& parent = {}) const override;
54 
57  QVariant data (const QModelIndex& index, int role = Qt::DisplayRole) const override;
58 
66  void SetSource (QAbstractItemModel *model);
67  protected:
87  virtual bool IsIndexAccepted (const QModelIndex& index) const;
88  private:
89  void HandleDataChanged (const QModelIndex&, const QModelIndex&);
90  void HandleRowsInserted (const QModelIndex&, int, int);
91  void HandleRowsAboutRemoved (const QModelIndex&, int, int);
92  };
93 }
QList< QPersistentModelIndex >
LC::Util
Definition: icoreproxy.h:33
modelsconfig.h
UTIL_MODELS_API
#define UTIL_MODELS_API
Definition: modelsconfig.h:16