ソースを参照

Fixed wrong data display if filter changes. Now if Patients tableview is empty due to filter change the other tableview are empty too

Andreas Fetzer 12 年 前
コミット
8fe182961e
共有1 個のファイルを変更した12 個の追加3 個の削除を含む
  1. 12 3
      Libs/DICOM/Widgets/ctkDICOMTableView.cpp

+ 12 - 3
Libs/DICOM/Widgets/ctkDICOMTableView.cpp

@@ -238,11 +238,20 @@ void ctkDICOMTableView::onFilterChanged()
 QStringList ctkDICOMTableView::getUIDsForAllRows()
 QStringList ctkDICOMTableView::getUIDsForAllRows()
 {
 {
   Q_D(ctkDICOMTableView);
   Q_D(ctkDICOMTableView);
-  int numberOfRows = d->tblDicomDatabaseView->model()->rowCount();
+  QAbstractItemModel* tableModel = d->tblDicomDatabaseView->model();
+  int numberOfRows = tableModel->rowCount();
   QStringList uids;
   QStringList uids;
-  for(int i = 0; i < numberOfRows; ++i)
+  if (numberOfRows == 0)
   {
   {
-    uids << (QString("'") + d->tblDicomDatabaseView->model()->index(i,0).data().toString() +"'");
+    //Return invalid UID if there are no rows
+    uids << QString("'#'");
+  }
+  else
+  {
+    for(int i = 0; i < numberOfRows; ++i)
+    {
+      uids << (QString("'") + tableModel->index(i,0).data().toString() +"'");
+    }
   }
   }
   return uids;
   return uids;
 }
 }