ctkDICOMTableView.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkDICOMTableView_h
  15. #define __ctkDICOMTableView_h
  16. // Qt includes
  17. #include <QItemSelection>
  18. #include <QWidget>
  19. // ctkDICOMCore includes
  20. #include "ctkDICOMDatabase.h"
  21. #include "ctkDICOMWidgetsExport.h"
  22. class ctkDICOMTableViewPrivate;
  23. /**
  24. * @brief The ctkDICOMTableView displays the content of a specific table of the ctkDICOMDatabase
  25. *
  26. * The ctkDICOMTableView holds a QTableView which displays the content of the selected
  27. * ctkDICOMDatabase. It also holds a ctkSearchBox which allows filtering of the table content.
  28. *
  29. * @ingroup DICOM_Widgets
  30. */
  31. class CTK_DICOM_WIDGETS_EXPORT ctkDICOMTableView : public QWidget
  32. {
  33. Q_OBJECT
  34. public:
  35. typedef QWidget Superclass;
  36. /**
  37. * ctor with tablename as parameter
  38. * @param parent the parent widget
  39. * @param queryTableName the name of the table of the ctkDICOMDatabase which shall be displayed
  40. */
  41. explicit ctkDICOMTableView(QWidget* parent = 0, QString queryTableName = "Patients");
  42. /**
  43. * ctor with tablename and database as parameter
  44. * @param ctkDicomDataBase the ctkDICOMDatabase which shall be used
  45. * @param parent the parent widget
  46. * @param queryTableName the name of the table of the ctkDICOMDatabase which shall be displayed
  47. */
  48. explicit ctkDICOMTableView (ctkDICOMDatabase* ctkDicomDataBase, QWidget* parent = 0, QString queryTableName = "Patients");
  49. virtual ~ctkDICOMTableView();
  50. /**
  51. * @brief Setting the ctkDICOMDatabase which shall be queried
  52. * @param dicomDataBase the underlying database
  53. */
  54. void setCTKDicomDataBase(ctkDICOMDatabase* dicomDatabase);
  55. /**
  56. * Setting the table name which shall be used for the database query
  57. * @param tableName the name of the database table
  58. */
  59. void setQueryTableName(const QString &tableName);
  60. /**
  61. * Setting the foreign key for the database query. This is usefull if e.g. you
  62. * want to select the studies for a certain patient
  63. * @param foreignKey the foreign key which will be used for the query
  64. */
  65. void setQueryForeignKey(const QString &foreignKey);
  66. /**
  67. * Set the query for the underlying database. If the uid list is not empty just the
  68. * entries with the according uids are selected
  69. * @param uids a list of uids which should be selected
  70. */
  71. void setQuery (const QStringList &uids = QStringList());
  72. /**
  73. * @brief Returns the uids of the current selected rows
  74. * @return a list containing all the uids of the selected rows
  75. */
  76. QStringList currentSelection();
  77. public Q_SLOTS:
  78. /**
  79. * @brief slot is called if the selection of the tableview is changed
  80. * Within this slot the signal signalSelectionChanged is emitted
  81. */
  82. void onSelectionChanged();
  83. /**
  84. * @brief Updates the query which is used for displaying the table content
  85. * @param uids the uids of the table entries which shall be displayed
  86. */
  87. void onUpdateQuery(const QStringList &uids);
  88. protected Q_SLOTS:
  89. /**
  90. * @brief Called when the underlying database changes
  91. */
  92. void onDatabaseChanged();
  93. /**
  94. * @brief Called when the text of the ctkSearchBox has changed
  95. */
  96. void onFilterChanged();
  97. Q_SIGNALS:
  98. /**
  99. * @brief Is emitted when the selection in the tableview has changed
  100. * @param uids the list of uids of the selected objects
  101. */
  102. void selectionChanged(const QStringList &uids);
  103. /**
  104. * @brief Is emitted when the data selection has changed
  105. */
  106. void selectionChanged(const QItemSelection&,const QItemSelection&);
  107. /**
  108. * @brief Is emitted when the query text has changed
  109. * @param uids the list of uids of the objects included in the query
  110. */
  111. void queryChanged(const QStringList &uids);
  112. protected:
  113. QScopedPointer<ctkDICOMTableViewPrivate> d_ptr;
  114. Q_DECLARE_PRIVATE(ctkDICOMTableView)
  115. Q_DISABLE_COPY(ctkDICOMTableView)
  116. };
  117. #endif // CTKDICOMTABLEVIEW_H