Browse Source

Filter and selection changes are now handled as query changes. Added documentation

Andreas Fetzer 11 years ago
parent
commit
b5adc9c0ff
2 changed files with 63 additions and 16 deletions
  1. 5 11
      Libs/DICOM/Widgets/ctkDICOMTableView.cpp
  2. 58 5
      Libs/DICOM/Widgets/ctkDICOMTableView.h

+ 5 - 11
Libs/DICOM/Widgets/ctkDICOMTableView.cpp

@@ -192,18 +192,12 @@ void ctkDICOMTableView::onSelectionChanged()
 
   QModelIndexList currentSelection = d->tblDicomDatabaseView->selectionModel()->selectedRows(0);
   QStringList uids;
-  if (currentSelection.empty())
-  {
-    emit signalSelectionChanged(uids);
-  }
-  else
+
+  foreach(QModelIndex i, currentSelection)
   {
-    foreach(QModelIndex i, currentSelection)
-    {
-      uids << (QString("'") + i.data().toString() +"'");
-    }
-    emit signalSelectionChanged(uids);
+    uids << (QString("'") + i.data().toString() +"'");
   }
+  emit signalQueryChanged(uids);
 }
 
 void ctkDICOMTableView::onDatabaseChanged()
@@ -237,7 +231,7 @@ void ctkDICOMTableView::onFilterChanged()
   Q_D(ctkDICOMTableView);
 
   QStringList uids = this->getUIDsForAllRows();
-  emit signalFilterChanged(uids);
+  emit signalQueryChanged(uids);
 }
 
 QStringList ctkDICOMTableView::getUIDsForAllRows()

+ 58 - 5
Libs/DICOM/Widgets/ctkDICOMTableView.h

@@ -32,8 +32,14 @@
 
 class ctkDICOMTableViewPrivate;
 
-/// \ingroup DICOM_Widgets
-
+/**
+ * @brief The ctkDICOMTableView displays the content of a specific table of the ctkDICOMDatabase
+ *
+ * The ctkDICOMTableView holds a QTableView which displays the content of the selected
+ * ctkDICOMDatabase. It also holds a ctkSearchBox which allows filtering of the table content.
+ *
+ * @ingroup DICOM_Widgets
+ */
 class CTK_DICOM_WIDGETS_EXPORT ctkDICOMTableView : public QWidget
 {
   Q_OBJECT
@@ -41,28 +47,75 @@ class CTK_DICOM_WIDGETS_EXPORT ctkDICOMTableView : public QWidget
 public:
   typedef QWidget Superclass;
 
+  /**
+   * ctor with tablename as parameter
+   * @param parent the parent widget
+   * @param queryTableName the name of the table of the ctkDICOMDatabase which shall be displayed
+   */
   explicit ctkDICOMTableView(QWidget* parent = 0, QString queryTableName = "Patients");
-  ctkDICOMTableView (QSharedPointer<ctkDICOMDatabase> ctkDicomDataBase, QWidget* parent = 0, QString queryTableName = "Patients");
+
+  /**
+   * ctor with tablename and database as parameter
+   * @param ctkDicomDataBase the ctkDICOMDatabase which shall be used
+   * @param parent the parent widget
+   * @param queryTableName the name of the table of the ctkDICOMDatabase which shall be displayed
+   */
+  explicit ctkDICOMTableView (QSharedPointer<ctkDICOMDatabase> ctkDicomDataBase, QWidget* parent = 0, QString queryTableName = "Patients");
+
   virtual ~ctkDICOMTableView();
 
   void setCTKDicomDataBase(QSharedPointer<ctkDICOMDatabase> dicomDataBase);
 
-  // Settings for querying the database
+  /**
+   * Setting the table name which shall be used for the database query
+   * @param tableName the name of the database table
+   */
   void setQueryTableName(const QString &tableName);
+
+  /**
+   * Setting the foreign key for the database query. This is usefull if e.g. you
+   * want to select the studies for a certain patient
+   * @param foreignKey the foreign key which will be used for the query
+   */
   void setQueryForeignKey(const QString &foreignKey);
+
   void setQueryPrimaryKey(const QString &primaryKey);
 
 public Q_SLOTS:
+
+  /**
+   * @brief slot is called if the selection of the tableview is changed
+   * Within this slot the signal signalSelectionChanged is emitted
+   */
   void onSelectionChanged();
+
+  /**
+   * @brief Updates the query which is used for displaying the table content
+   * @param uids the uids of the table entries which shall be displayed
+   */
   void onUpdateQuery(const QStringList &uids);
 
 protected Q_SLOTS:
+  /**
+   * @brief Called when the underlying database changes
+   */
   void onDatabaseChanged();
+
+  /**
+   * @brief Called when the text of the ctkSearchBox has changed
+   */
   void onFilterChanged();
 
 Q_SIGNALS:
+  /**
+   * @brief Is emitted when the selection in the tableview has changed
+   * @param uids the list of uids of the selected objects
+   */
   void signalSelectionChanged(const QStringList &uids);
-  void signalFilterChanged(const QStringList &uids);
+  /**
+   * @brief Is emitted when the filter text has changed
+   * @param uids the list of uids of the selected objects
+   */
   void signalQueryChanged(const QStringList &uids);
   void signalSelectionChanged(const QItemSelection&,const QItemSelection&);