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 class QTableView;
34 
43 class CTK_DICOM_WIDGETS_EXPORT ctkDICOMTableView : public QWidget
44 {
45  Q_OBJECT
46  Q_PROPERTY(bool filterActive READ filterActive)
47  Q_PROPERTY( QTableView* tblDicomDatabaseView READ tableView )
48 
49 public:
50  typedef QWidget Superclass;
51 
56  explicit ctkDICOMTableView(QWidget* parent = 0);
62  explicit ctkDICOMTableView(QString queryTableName, QWidget* parent = 0);
63 
70  explicit ctkDICOMTableView (ctkDICOMDatabase* dicomDataBase, QString queryTableName, QWidget* parent = 0);
71 
72  virtual ~ctkDICOMTableView();
73 
78  void setDicomDataBase(ctkDICOMDatabase* dicomDatabase);
79 
84  void setQueryTableName(const QString &tableName);
85 
91  void setQueryForeignKey(const QString &foreignKey);
92 
98  void setQuery (const QStringList &uids = QStringList());
99 
104  void addSqlWhereCondition(const std::pair<QString, QStringList>& condition);
105 
110  QStringList currentSelection() const;
111 
116  QStringList uidsForAllRows() const;
117 
118  bool filterActive();
119 
120  void setTableSectionSize(int);
121  int tableSectionSize();
122 
127  QTableView* tableView();
128 
129 public Q_SLOTS:
130 
135  void onSelectionChanged();
136 
141  void onUpdateQuery(const QStringList &uids);
142 
148  void onCustomContextMenuRequested(const QPoint &point);
149 
150 protected Q_SLOTS:
154  void onDatabaseChanged();
155 
159  void onFilterChanged();
160 
164  void onInstanceAdded();
165 
166  void selectAll();
167 
168 protected:
169  virtual bool eventFilter(QObject *obj, QEvent *event);
170 
171 Q_SIGNALS:
176  void selectionChanged(const QStringList &uids);
177 
181  void selectionChanged(const QItemSelection&,const QItemSelection&);
182 
187  void queryChanged(const QStringList &uids);
188 
189  void doubleClicked(const QModelIndex&);
190 
191 protected:
192  QScopedPointer<ctkDICOMTableViewPrivate> d_ptr;
193 
194  Q_DECLARE_PRIVATE(ctkDICOMTableView)
195  Q_DISABLE_COPY(ctkDICOMTableView)
196 };
197 
198 #endif // __ctkDICOMTableView_h
ctkDICOMTableView::Superclass
QWidget Superclass
Definition: ctkDICOMTableView.h:50
ctkDICOMDatabase
Definition: ctkDICOMDatabase.h:52
ctkDICOMTableView
The ctkDICOMTableView displays the content of a specific table of the ctkDICOMDatabase.
Definition: ctkDICOMTableView.h:43
ctkDICOMDatabase.h