ctkDICOMTableManager.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 QItemSelection;
  24. class QModelIndex;
  25. /// \ingroup DICOM_Widgets
  26. class CTK_DICOM_WIDGETS_EXPORT ctkDICOMTableManager : public QWidget
  27. {
  28. Q_OBJECT
  29. /**
  30. * Property for setting the table layout either to vertical or horizontal alignment
  31. */
  32. Q_PROPERTY(Qt::Orientation tableOrientation READ tableOrientation WRITE setTableOrientation)
  33. /**
  34. * Property for setting a dynamic table layout which switches according to the current
  35. * window size between vertical and horizontal layout
  36. */
  37. Q_PROPERTY(bool dynamicTableLayout READ dynamicTableLayout WRITE setDynamicTableLayout)
  38. Q_ENUMS(DisplayDensity)
  39. /**
  40. * This property holds the density of tables in the table Manager. There are three denisity
  41. * levels: Comfortable (least dense), Cozy and Compact (most dense).
  42. */
  43. Q_PROPERTY(ctkDICOMTableManager::DisplayDensity displayDensity READ displayDensity WRITE setDisplayDensity);
  44. public:
  45. typedef QWidget Superclass;
  46. explicit ctkDICOMTableManager(QWidget* parent = 0);
  47. ctkDICOMTableManager(ctkDICOMDatabase* db, QWidget* parent = 0);
  48. virtual ~ctkDICOMTableManager();
  49. /**
  50. * @brief Set the ctkDICOMDatabase
  51. * @param db the dicom database which should be used
  52. */
  53. void setDICOMDatabase(ctkDICOMDatabase* db);
  54. void setTableOrientation(const Qt::Orientation&) const;
  55. Qt::Orientation tableOrientation();
  56. /**
  57. * @brief Get the current selection of the dicomTableViews
  58. * @return a list with the uids of the selected items
  59. */
  60. QStringList currentPatientsSelection();
  61. QStringList currentStudiesSelection();
  62. QStringList currentSeriesSelection();
  63. void setDynamicTableLayout(bool);
  64. bool dynamicTableLayout() const;
  65. void updateTableViews();
  66. enum DisplayDensity
  67. {
  68. Compact = 0,
  69. Cozy = 1,
  70. Comfortable = 2
  71. };
  72. DisplayDensity displayDensity();
  73. void setDisplayDensity(DisplayDensity density);
  74. public Q_SLOTS:
  75. void onPatientsQueryChanged(const QStringList&);
  76. void onStudiesQueryChanged(const QStringList&);
  77. void onPatientsSelectionChanged(const QStringList&);
  78. void onStudiesSelectionChanged(const QStringList&);
  79. Q_SIGNALS:
  80. /// Signals for propagating selection changes of the different tables
  81. void patientsSelectionChanged(const QItemSelection&, const QItemSelection&);
  82. void studiesSelectionChanged(const QItemSelection&, const QItemSelection&);
  83. void seriesSelectionChanged(const QItemSelection&, const QItemSelection&);
  84. void patientsSelectionChanged(const QStringList &uids);
  85. void studiesSelectionChanged(const QStringList &uids);
  86. void seriesSelectionChanged(const QStringList &uids);
  87. void seriesDoubleClicked(const QModelIndex&);
  88. protected:
  89. virtual void resizeEvent(QResizeEvent *);
  90. QScopedPointer<ctkDICOMTableManagerPrivate> d_ptr;
  91. private:
  92. Q_DECLARE_PRIVATE(ctkDICOMTableManager)
  93. Q_DISABLE_COPY(ctkDICOMTableManager)
  94. };
  95. #endif // __ctkDICOMTableManager_h