Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerModuleFactoryFilterModel.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Julien Finet, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerModuleFactoryFilterModel_h
22 #define __qSlicerModuleFactoryFilterModel_h
23 
24 // Qt includes
25 #include <QSortFilterProxyModel>
26 #include <QStringList>
27 
28 // QtGUI includes
29 #include "qSlicerBaseQTGUIExport.h"
30 class qSlicerModuleFactoryFilterModelPrivate;
31 
32 class Q_SLICER_BASE_QTGUI_EXPORT qSlicerModuleFactoryFilterModel
33  : public QSortFilterProxyModel
34 {
35  Q_OBJECT
37  Q_PROPERTY(bool showToLoad READ showToLoad WRITE setShowToLoad)
39  Q_PROPERTY(bool showToIgnore READ showToIgnore WRITE setShowToIgnore)
41  Q_PROPERTY(bool showLoaded READ showLoaded WRITE setShowLoaded)
43  Q_PROPERTY(bool showIgnored READ showIgnored WRITE setShowIgnored)
45  Q_PROPERTY(bool showFailed READ showFailed WRITE setShowFailed)
46 
49  Q_PROPERTY(QStringList showModules READ showModules WRITE setShowModules NOTIFY showModulesChanged)
51  Q_PROPERTY(bool hideAllWhenShowModulesIsEmpty READ hideAllWhenShowModulesIsEmpty WRITE setHideAllWhenShowModulesIsEmpty)
52 public:
54  typedef QSortFilterProxyModel Superclass;
55 
57  explicit qSlicerModuleFactoryFilterModel(QObject* parent = 0);
58 
61 
62  bool showToLoad()const;
63  bool showToIgnore()const;
64  bool showLoaded()const;
65  bool showIgnored()const;
66  bool showFailed()const;
67 
68  QStringList showModules()const;
69 
70  bool hideAllWhenShowModulesIsEmpty()const;
71  void setHideAllWhenShowModulesIsEmpty(bool hide);
72  virtual Qt::DropActions supportedDropActions()const;
73  virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action,
74  int row, int column, const QModelIndex &parent);
75 
76 public slots:
77  void setShowToLoad(bool show);
78  void setShowToIgnore(bool show);
79  void setShowLoaded(bool show);
80  void setShowIgnored(bool show);
81  void setShowFailed(bool show);
82 
83  void setShowModules(const QStringList& modules);
84 
85 signals:
86  void showModulesChanged(const QStringList&)const;
87 protected:
88  QScopedPointer<qSlicerModuleFactoryFilterModelPrivate> d_ptr;
89 
90  virtual bool lessThan(const QModelIndex& leftIndex,
91  const QModelIndex& rightIndex)const;
92  virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent)const;
93 
94 private:
95  Q_DECLARE_PRIVATE(qSlicerModuleFactoryFilterModel);
96  Q_DISABLE_COPY(qSlicerModuleFactoryFilterModel);
97 };
98 
99 #endif
100 
QSortFilterProxyModel Superclass
Superclass typedef.