ctkDICOMTableManager.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. Q_ENUMS(DisplayDensity)
  40. /**
  41. * This property holds the density of tables in the table Manager. There are three denisity
  42. * levels: Comfortable (least dense), Cozy and Compact (most dense).
  43. */
  44. Q_PROPERTY(ctkDICOMTableManager::DisplayDensity displayDensity READ displayDensity WRITE setDisplayDensity);
  45. public:
  46. typedef QWidget Superclass;
  47. explicit ctkDICOMTableManager(QWidget* parent = 0);
  48. ctkDICOMTableManager(ctkDICOMDatabase* db, QWidget* parent = 0);
  49. virtual ~ctkDICOMTableManager();
  50. /**
  51. * @brief Set the ctkDICOMDatabase
  52. * @param db the dicom database which should be used
  53. */
  54. Q_INVOKABLE void setDICOMDatabase(ctkDICOMDatabase* db);
  55. void setTableOrientation(const Qt::Orientation&) const;
  56. Qt::Orientation tableOrientation();
  57. /**
  58. * @brief Get the current selection of the dicomTableViews
  59. * @return a list with the uids of the selected items
  60. */
  61. Q_INVOKABLE QStringList currentPatientsSelection();
  62. Q_INVOKABLE QStringList currentStudiesSelection();
  63. Q_INVOKABLE QStringList currentSeriesSelection();
  64. void setDynamicTableLayout(bool);
  65. bool dynamicTableLayout() const;
  66. Q_INVOKABLE void updateTableViews();
  67. enum DisplayDensity
  68. {
  69. Compact = 0,
  70. Cozy = 1,
  71. Comfortable = 2
  72. };
  73. DisplayDensity displayDensity();
  74. void setDisplayDensity(DisplayDensity density);
  75. Q_INVOKABLE ctkDICOMTableView* patientsTable();
  76. Q_INVOKABLE ctkDICOMTableView* studiesTable();
  77. Q_INVOKABLE ctkDICOMTableView* seriesTable();
  78. public Q_SLOTS:
  79. void onPatientsQueryChanged(const QStringList&);
  80. void onStudiesQueryChanged(const QStringList&);
  81. void onPatientsSelectionChanged(const QStringList&);
  82. void onStudiesSelectionChanged(const QStringList&);
  83. Q_SIGNALS:
  84. /// Signals for propagating selection changes of the different tables
  85. void patientsSelectionChanged(const QItemSelection&, const QItemSelection&);
  86. void studiesSelectionChanged(const QItemSelection&, const QItemSelection&);
  87. void seriesSelectionChanged(const QItemSelection&, const QItemSelection&);
  88. void patientsSelectionChanged(const QStringList &uids);
  89. void studiesSelectionChanged(const QStringList &uids);
  90. void seriesSelectionChanged(const QStringList &uids);
  91. void patientsDoubleClicked( const QModelIndex&);
  92. void studiesDoubleClicked( const QModelIndex&);
  93. void seriesDoubleClicked(const QModelIndex&);
  94. // signals to propagate the context menu requests from
  95. // the individual tables
  96. void patientsRightClicked(const QPoint&);
  97. void studiesRightClicked(const QPoint&);
  98. void seriesRightClicked(const QPoint&);
  99. protected:
  100. virtual void resizeEvent(QResizeEvent *);
  101. QScopedPointer<ctkDICOMTableManagerPrivate> d_ptr;
  102. private:
  103. Q_DECLARE_PRIVATE(ctkDICOMTableManager)
  104. Q_DISABLE_COPY(ctkDICOMTableManager)
  105. };
  106. #endif // __ctkDICOMTableManager_h