CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkDICOMTableView.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 __ctkDICOMTableView_h
22 #define __ctkDICOMTableView_h
23 
24 // Qt includes
25 #include <QItemSelection>
26 #include <QWidget>
27 
28 // ctkDICOMCore includes
29 #include "ctkDICOMDatabase.h"
30 #include "ctkDICOMWidgetsExport.h"
31 
32 class ctkDICOMTableViewPrivate;
33 
42 class CTK_DICOM_WIDGETS_EXPORT ctkDICOMTableView : public QWidget
43 {
44  Q_OBJECT
45  Q_PROPERTY(bool filterActive READ filterActive)
46 
47 public:
48  typedef QWidget Superclass;
49 
54  explicit ctkDICOMTableView(QWidget* parent = 0);
60  explicit ctkDICOMTableView(QString queryTableName, QWidget* parent = 0);
61 
68  explicit ctkDICOMTableView (ctkDICOMDatabase* dicomDataBase, QString queryTableName, QWidget* parent = 0);
69 
70  virtual ~ctkDICOMTableView();
71 
76  void setDicomDataBase(ctkDICOMDatabase* dicomDatabase);
77 
82  void setQueryTableName(const QString &tableName);
83 
89  void setQueryForeignKey(const QString &foreignKey);
90 
96  void setQuery (const QStringList &uids = QStringList());
97 
102  void addSqlWhereCondition(const std::pair<QString, QStringList>& condition);
103 
108  QStringList currentSelection() const;
109 
114  QStringList uidsForAllRows() const;
115 
116  bool filterActive();
117 
118  void setTableSectionSize(int);
119  int tableSectionSize();
120 
121 public Q_SLOTS:
122 
127  void onSelectionChanged();
128 
133  void onUpdateQuery(const QStringList &uids);
134 
140  void onCustomContextMenuRequested(const QPoint &point);
141 
142 protected Q_SLOTS:
146  void onDatabaseChanged();
147 
151  void onFilterChanged();
152 
156  void onInstanceAdded();
157 
158  void selectAll();
159 
160 protected:
161  virtual bool eventFilter(QObject *obj, QEvent *event);
162 
163 Q_SIGNALS:
168  void selectionChanged(const QStringList &uids);
169 
173  void selectionChanged(const QItemSelection&,const QItemSelection&);
174 
179  void queryChanged(const QStringList &uids);
180 
181  void doubleClicked(const QModelIndex&);
182 
183 protected:
184  QScopedPointer<ctkDICOMTableViewPrivate> d_ptr;
185 
186  Q_DECLARE_PRIVATE(ctkDICOMTableView)
187  Q_DISABLE_COPY(ctkDICOMTableView)
188 };
189 
190 #endif // __ctkDICOMTableView_h
The ctkDICOMTableView displays the content of a specific table of the ctkDICOMDatabase.
QScopedPointer< ctkDICOMTableViewPrivate > d_ptr