CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkFlatProxyModel.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkFlatProxyModel_h
22 #define __ctkFlatProxyModel_h
23 
24 // QT includes
25 #include <QAbstractProxyModel>
26 
27 // CTK includes
28 #include "ctkWidgetsExport.h"
29 
30 class ctkFlatProxyModelPrivate;
31 
39 class CTK_WIDGETS_EXPORT ctkFlatProxyModel : public QAbstractProxyModel
40 {
41  Q_OBJECT
44  Q_PROPERTY(int startFlattenLevel READ startFlattenLevel WRITE setStartFlattenLevel)
46  Q_PROPERTY(int endFlattenLevel READ endFlattenLevel WRITE setEndFlattenLevel)
49  Q_PROPERTY(int hideLevel READ hideLevel WRITE setHideLevel)
50 
51 public:
52  typedef QAbstractProxyModel Superclass;
53 
54  ctkFlatProxyModel(QObject *parentObject = 0);
55  virtual ~ctkFlatProxyModel();
56 
57  void setStartFlattenLevel(int level);
58  int startFlattenLevel() const;
59 
60  void setEndFlattenLevel(int level);
61  int endFlattenLevel() const;
62 
63  void setHideLevel(int level);
64  int hideLevel() const;
65 
66  virtual QModelIndex mapFromSource( const QModelIndex& sourceIndex ) const;
67  virtual QModelIndex mapToSource( const QModelIndex& sourceIndex ) const;
68 
69  virtual QModelIndex index(int row, int column, const QModelIndex &parent) const;
70  virtual QModelIndex parent(const QModelIndex &child) const;
71  virtual int rowCount(const QModelIndex &parent) const;
72  virtual int columnCount(const QModelIndex &parent) const;
73 
74 protected:
75  QScopedPointer<ctkFlatProxyModelPrivate> d_ptr;
76 
77 private:
78  Q_DECLARE_PRIVATE(ctkFlatProxyModel);
79  Q_DISABLE_COPY(ctkFlatProxyModel);
80 };
81 
82 #endif
int startFlattenLevel() const
QAbstractProxyModel Superclass
virtual QModelIndex mapToSource(const QModelIndex &sourceIndex) const
void setEndFlattenLevel(int level)
int hideLevel() const
QScopedPointer< ctkFlatProxyModelPrivate > d_ptr
virtual ~ctkFlatProxyModel()
int endFlattenLevel() const
virtual QModelIndex parent(const QModelIndex &child) const
void setHideLevel(int level)
ctkFlatProxyModel(QObject *parentObject=0)
virtual int columnCount(const QModelIndex &parent) const
void setStartFlattenLevel(int level)
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const
virtual int rowCount(const QModelIndex &parent) const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const