Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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"
30class qSlicerModuleFactoryFilterModelPrivate;
31
32class 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)
58public:
60 typedef QSortFilterProxyModel Superclass;
61
63 {
64 ModuleNameRole = Qt::UserRole,
65 IsBuiltInRole = Qt::UserRole + 1,
66 IsTestingRole = Qt::UserRole + 2,
67 IsHiddenRole = Qt::UserRole + 3,
68 SearchRole = Qt::UserRole + 4,
69 FullTextSearchRole = Qt::UserRole + 5
70 };
71
73 explicit qSlicerModuleFactoryFilterModel(QObject* parent = nullptr);
74
77
78 bool showToLoad()const;
79 bool showToIgnore()const;
80 bool showLoaded()const;
81 bool showIgnored()const;
82 bool showFailed()const;
83 bool showBuiltIn()const;
84 bool showTesting()const;
85 bool showHidden()const;
86
87 QStringList showModules()const;
88
91 Qt::DropActions supportedDropActions()const override;
92 bool dropMimeData(const QMimeData *data, Qt::DropAction action,
93 int row, int column, const QModelIndex &parent) override;
94
95public slots:
96 void setShowToLoad(bool show);
97 void setShowToIgnore(bool show);
98 void setShowLoaded(bool show);
99 void setShowIgnored(bool show);
100 void setShowFailed(bool show);
101 void setShowBuiltIn(bool show);
102 void setShowTesting(bool show);
103 void setShowHidden(bool show);
104
105 void setShowModules(const QStringList& modules);
106
107signals:
108 void showModulesChanged(const QStringList&)const;
109protected:
110 QScopedPointer<qSlicerModuleFactoryFilterModelPrivate> d_ptr;
111
112 bool lessThan(const QModelIndex& leftIndex,
113 const QModelIndex& rightIndex)const override;
114 bool filterAcceptsRow(int source_row, const QModelIndex& source_parent)const override;
115
116private:
117 Q_DECLARE_PRIVATE(qSlicerModuleFactoryFilterModel);
118 Q_DISABLE_COPY(qSlicerModuleFactoryFilterModel);
119};
120
121#endif
QScopedPointer< qSlicerModuleFactoryFilterModelPrivate > d_ptr
void showModulesChanged(const QStringList &) const
Qt::DropActions supportedDropActions() const override
QSortFilterProxyModel Superclass
Superclass typedef.
bool lessThan(const QModelIndex &leftIndex, const QModelIndex &rightIndex) const override
QStringList showModules() const
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
void setShowModules(const QStringList &modules)
~qSlicerModuleFactoryFilterModel() override
Destructor.
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
qSlicerModuleFactoryFilterModel(QObject *parent=nullptr)
Constructor.
bool hideAllWhenShowModulesIsEmpty() const
void setHideAllWhenShowModulesIsEmpty(bool hide)