Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerModulesListView.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 __qSlicerModulesListView_h
22 #define __qSlicerModulesListView_h
23 
24 // Qt includes
25 #include <QListView>
26 
27 // QtGUI includes
28 #include "qSlicerBaseQTGUIExport.h"
29 
30 class qSlicerModulesListViewPrivate;
33 class QStandardItem;
34 
35 class Q_SLICER_BASE_QTGUI_EXPORT qSlicerModulesListView : public QListView
36 {
37  Q_OBJECT
39  Q_PROPERTY(bool checkBoxVisible READ isCheckBoxVisible WRITE setCheckBoxVisible )
40  Q_PROPERTY(QStringList modules READ modules)
41  Q_PROPERTY(QStringList checkedModules READ checkedModules
42  WRITE setCheckedModules NOTIFY checkedModulesChanged
43  DESIGNABLE false)
44  Q_PROPERTY(QStringList uncheckedModules READ uncheckedModules
45  WRITE setUncheckedModules NOTIFY uncheckedModulesChanged
46  DESIGNABLE false)
47 public:
49  typedef QListView Superclass;
50 
52  explicit qSlicerModulesListView(QWidget* parent = nullptr);
53 
55  ~qSlicerModulesListView() override;
56 
59  Q_INVOKABLE qSlicerAbstractModuleFactoryManager* factoryManager()const;
60 
61  Q_INVOKABLE qSlicerModuleFactoryFilterModel* filterModel()const;
62 
64  QStringList modules()const;
65 
66  bool isCheckBoxVisible()const;
69  QStringList checkedModules()const;
70 
73  QStringList uncheckedModules()const;
74 
75 public slots:
78  void setFactoryManager(qSlicerAbstractModuleFactoryManager* manager);
79 
80  void setCheckBoxVisible(bool show);
81 
84  void setCheckedModules(const QStringList& moduleNames);
85 
88  void setUncheckedModules(const QStringList& moduleNames);
89 
90  void hideSelectedModules();
91  void moveLeftSelectedModules();
92  void moveRightSelectedModules();
93  void moveSelectedModules(int offset);
94 
95  void scrollToSelectedModules();
96 signals:
98  void checkedModulesChanged(const QStringList&);
100  void uncheckedModulesChanged(const QStringList&);
101 
102 protected slots:
103  void addModules(const QStringList& moduleNames);
104  void addModule(const QString& moduleName);
105  void updateModules();
106  void updateModules(const QStringList& moduleName);
107  void updateModule(const QString& moduleName);
108  void onItemChanged(QStandardItem* item);
109 
110 protected:
111  QScopedPointer<qSlicerModulesListViewPrivate> d_ptr;
112 
113  void changeEvent(QEvent* e) override;
114  void keyPressEvent(QKeyEvent * event) override;
115 
116 private:
117  Q_DECLARE_PRIVATE(qSlicerModulesListView);
118  Q_DISABLE_COPY(qSlicerModulesListView);
119 };
120 
121 #endif
122 
QListView Superclass
Superclass typedef.