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 
122 
127  QTableView* tableView();
128 
129 public Q_SLOTS:
130 
136 
141  void onUpdateQuery(const QStringList &uids);
142 
148  void onCustomContextMenuRequested(const QPoint &point);
149 
150 protected Q_SLOTS:
155 
160 
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::selectAll
void selectAll()
ctkDICOMTableView::ctkDICOMTableView
ctkDICOMTableView(ctkDICOMDatabase *dicomDataBase, QString queryTableName, QWidget *parent=0)
ctkDICOMTableView::Superclass
QWidget Superclass
Definition: ctkDICOMTableView.h:50
ctkDICOMTableView::selectionChanged
void selectionChanged(const QItemSelection &, const QItemSelection &)
Is emitted when the data selection has changed.
ctkDICOMTableView::onDatabaseChanged
void onDatabaseChanged()
Called when the underlying database changes.
ctkDICOMDatabase
Definition: ctkDICOMDatabase.h:53
ctkDICOMTableView::ctkDICOMTableView
ctkDICOMTableView(QString queryTableName, QWidget *parent=0)
ctkDICOMTableView
The ctkDICOMTableView displays the content of a specific table of the ctkDICOMDatabase.
Definition: ctkDICOMTableView.h:44
ctkDICOMTableView::doubleClicked
void doubleClicked(const QModelIndex &)
ctkDICOMTableView::onCustomContextMenuRequested
void onCustomContextMenuRequested(const QPoint &point)
Translates the local point to a global one.
ctkDICOMTableView::selectionChanged
void selectionChanged(const QStringList &uids)
Is emitted when the selection in the tableview has changed.
ctkDICOMTableView::onFilterChanged
void onFilterChanged()
Called when the text of the ctkSearchBox has changed.
ctkDICOMDatabase.h
ctkDICOMTableView::uidsForAllRows
QStringList uidsForAllRows() const
Getting the UIDs for all rows.
ctkDICOMTableView::filterActive
bool filterActive()
ctkDICOMTableView::currentSelection
QStringList currentSelection() const
Returns the uids of the current selected rows.
ctkDICOMTableView::tableSectionSize
int tableSectionSize()
ctkDICOMTableView::d_ptr
QScopedPointer< ctkDICOMTableViewPrivate > d_ptr
Definition: ctkDICOMTableView.h:192
ctkDICOMTableView::onSelectionChanged
void onSelectionChanged()
slot is called if the selection of the tableview is changed Within this slot the signal signalSelecti...
ctkDICOMTableView::setQueryForeignKey
void setQueryForeignKey(const QString &foreignKey)
ctkDICOMTableView::onUpdateQuery
void onUpdateQuery(const QStringList &uids)
Updates the query which is used for displaying the table content.
ctkDICOMTableView::~ctkDICOMTableView
virtual ~ctkDICOMTableView()
ctkDICOMTableView::addSqlWhereCondition
void addSqlWhereCondition(const std::pair< QString, QStringList > &condition)
Add a where condition to the usual select statement.
ctkDICOMTableView::setDicomDataBase
void setDicomDataBase(ctkDICOMDatabase *dicomDatabase)
Setting the ctkDICOMDatabase which shall be queried.
ctkDICOMTableView::setQueryTableName
void setQueryTableName(const QString &tableName)
ctkDICOMTableView::ctkDICOMTableView
ctkDICOMTableView(QWidget *parent=0)
ctkDICOMTableView::setQuery
void setQuery(const QStringList &uids=QStringList())
ctkDICOMTableView::setTableSectionSize
void setTableSectionSize(int)
ctkDICOMTableView::queryChanged
void queryChanged(const QStringList &uids)
Is emitted when the query text has changed.
ctkDICOMTableView::tableView
QTableView * tableView()
Get the actual QTableView, for specific view settings.
ctkDICOMTableView::eventFilter
virtual bool eventFilter(QObject *obj, QEvent *event)
ctkDICOMTableView::onInstanceAdded
void onInstanceAdded()
Called if a new instance was added to the database.