Slicer  5.3
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)
47  Q_PROPERTY(bool showBuiltIn READ showBuiltIn WRITE setShowBuiltIn)
49  Q_PROPERTY(bool showTesting READ showTesting WRITE setShowTesting)
51  Q_PROPERTY(bool showHidden READ showHidden WRITE setShowHidden)
52 
55  Q_PROPERTY(QStringList showModules READ showModules WRITE setShowModules NOTIFY showModulesChanged)
57  Q_PROPERTY(bool hideAllWhenShowModulesIsEmpty READ hideAllWhenShowModulesIsEmpty WRITE setHideAllWhenShowModulesIsEmpty)
58 public:
60  typedef QSortFilterProxyModel Superclass;
61 
63  explicit qSlicerModuleFactoryFilterModel(QObject* parent = nullptr);
64 
67 
68  bool showToLoad()const;
69  bool showToIgnore()const;
70  bool showLoaded()const;
71  bool showIgnored()const;
72  bool showFailed()const;
73  bool showBuiltIn()const;
74  bool showTesting()const;
75  bool showHidden()const;
76 
77  QStringList showModules()const;
78 
79  bool hideAllWhenShowModulesIsEmpty()const;
80  void setHideAllWhenShowModulesIsEmpty(bool hide);
81  Qt::DropActions supportedDropActions()const override;
82  bool dropMimeData(const QMimeData *data, Qt::DropAction action,
83  int row, int column, const QModelIndex &parent) override;
84 
85 public slots:
86  void setShowToLoad(bool show);
87  void setShowToIgnore(bool show);
88  void setShowLoaded(bool show);
89  void setShowIgnored(bool show);
90  void setShowFailed(bool show);
91  void setShowBuiltIn(bool show);
92  void setShowTesting(bool show);
93  void setShowHidden(bool show);
94 
95  void setShowModules(const QStringList& modules);
96 
97 signals:
98  void showModulesChanged(const QStringList&)const;
99 protected:
100  QScopedPointer<qSlicerModuleFactoryFilterModelPrivate> d_ptr;
101 
102  bool lessThan(const QModelIndex& leftIndex,
103  const QModelIndex& rightIndex)const override;
104  bool filterAcceptsRow(int source_row, const QModelIndex& source_parent)const override;
105 
106 private:
107  Q_DECLARE_PRIVATE(qSlicerModuleFactoryFilterModel);
108  Q_DISABLE_COPY(qSlicerModuleFactoryFilterModel);
109 };
110 
111 #endif
112 
QSortFilterProxyModel Superclass
Superclass typedef.