ctkDICOMTableManager.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 __ctkDICOMTableManager_h
  15. #define __ctkDICOMTableManager_h
  16. #include "ctkDICOMWidgetsExport.h"
  17. #include "ctkDICOMDatabase.h"
  18. // Qt includes
  19. #include <QWidget>
  20. #include <QSharedPointer>
  21. class ctkDICOMTableManagerPrivate;
  22. class ctkDICOMDatabase;
  23. class ctkDICOMTableView;
  24. class QItemSelection;
  25. class QModelIndex;
  26. /// \ingroup DICOM_Widgets
  27. class CTK_DICOM_WIDGETS_EXPORT ctkDICOMTableManager : public QWidget
  28. {
  29. Q_OBJECT
  30. /**
  31. * Property for setting the table layout either to vertical or horizontal alignment
  32. */
  33. Q_PROPERTY(Qt::Orientation tableOrientation READ tableOrientation WRITE setTableOrientation)
  34. /**
  35. * Property for setting a dynamic table layout which switches according to the current
  36. * window size between vertical and horizontal layout
  37. */
  38. Q_PROPERTY(bool dynamicTableLayout READ dynamicTableLayout WRITE setDynamicTableLayout)
  39. /**
  40. * Properties for the different table views (patients, studies, series).
  41. */
  42. Q_PROPERTY( ctkDICOMTableView* patientsTable READ patientsTable )
  43. Q_PROPERTY( ctkDICOMTableView* studiesTable READ studiesTable )
  44. Q_PROPERTY( ctkDICOMTableView* seriesTable READ seriesTable )
  45. Q_ENUMS(DisplayDensity)
  46. /**
  47. * This property holds the density of tables in the table Manager. There are three denisity
  48. * levels: Comfortable (least dense), Cozy and Compact (most dense).
  49. */
  50. Q_PROPERTY(ctkDICOMTableManager::DisplayDensity displayDensity READ displayDensity WRITE setDisplayDensity);
  51. public:
  52. typedef QWidget Superclass;
  53. explicit ctkDICOMTableManager(QWidget* parent = 0);
  54. ctkDICOMTableManager(ctkDICOMDatabase* db, QWidget* parent = 0);
  55. virtual ~ctkDICOMTableManager();
  56. /**
  57. * @brief Set the ctkDICOMDatabase
  58. * @param db the dicom database which should be used
  59. */
  60. void setDICOMDatabase(ctkDICOMDatabase* db);
  61. void setTableOrientation(const Qt::Orientation&) const;
  62. Qt::Orientation tableOrientation();
  63. /**
  64. * @brief Get the current selection of the dicomTableViews
  65. * @return a list with the uids of the selected items
  66. */
  67. QStringList currentPatientsSelection();
  68. QStringList currentStudiesSelection();
  69. QStringList currentSeriesSelection();
  70. void setDynamicTableLayout(bool);
  71. bool dynamicTableLayout() const;
  72. void updateTableViews();
  73. enum DisplayDensity
  74. {
  75. Compact = 0,
  76. Cozy = 1,
  77. Comfortable = 2
  78. };
  79. DisplayDensity displayDensity();
  80. void setDisplayDensity(DisplayDensity density);
  81. ctkDICOMTableView* patientsTable();
  82. ctkDICOMTableView* studiesTable();
  83. ctkDICOMTableView* seriesTable();
  84. public Q_SLOTS:
  85. void onPatientsQueryChanged(const QStringList&);
  86. void onStudiesQueryChanged(const QStringList&);
  87. void onPatientsSelectionChanged(const QStringList&);
  88. void onStudiesSelectionChanged(const QStringList&);
  89. Q_SIGNALS:
  90. /// Signals for propagating selection changes of the different tables
  91. void patientsSelectionChanged(const QItemSelection&, const QItemSelection&);
  92. void studiesSelectionChanged(const QItemSelection&, const QItemSelection&);
  93. void seriesSelectionChanged(const QItemSelection&, const QItemSelection&);
  94. void patientsSelectionChanged(const QStringList &uids);
  95. void studiesSelectionChanged(const QStringList &uids);
  96. void seriesSelectionChanged(const QStringList &uids);
  97. void patientsDoubleClicked( const QModelIndex&);
  98. void studiesDoubleClicked( const QModelIndex&);
  99. void seriesDoubleClicked(const QModelIndex&);
  100. // signals to propagate the context menu requests from
  101. // the individual tables
  102. void patientsRightClicked(const QPoint&);
  103. void studiesRightClicked(const QPoint&);
  104. void seriesRightClicked(const QPoint&);
  105. protected:
  106. virtual void resizeEvent(QResizeEvent *);
  107. QScopedPointer<ctkDICOMTableManagerPrivate> d_ptr;
  108. private:
  109. Q_DECLARE_PRIVATE(ctkDICOMTableManager)
  110. Q_DISABLE_COPY(ctkDICOMTableManager)
  111. };
  112. #endif // __ctkDICOMTableManager_h