Sfoglia il codice sorgente

Ignore double-clicking on thumbnails of type image

nherlambang 14 anni fa
parent
commit
1d4f6fd600
1 ha cambiato i file con 11 aggiunte e 3 eliminazioni
  1. 11 3
      Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp

+ 11 - 3
Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp

@@ -228,9 +228,17 @@ void ctkDICOMAppWidget::onThumbnailDoubleClicked(const ctkDICOMThumbnailWidget&
 {
     Q_D(ctkDICOMAppWidget);
 
-    d->treeView->setCurrentIndex(widget.sourceIndex());
-    d->thumbnailsWidget->onModelSelected(widget.sourceIndex());
-    d->imagePreview->onModelSelected(widget.sourceIndex());
+    QModelIndex index = widget.sourceIndex();
+
+    ctkDICOMModel* model = const_cast<ctkDICOMModel*>(qobject_cast<const ctkDICOMModel*>(index.model()));
+    QModelIndex index0 = index.sibling(index.row(), 0);
+
+    if(model && (model->data(index0,ctkDICOMModel::TypeRole) != ctkDICOMModel::ImageType)){
+
+        d->treeView->setCurrentIndex(index0);
+        d->thumbnailsWidget->onModelSelected(index0);
+        d->imagePreview->onModelSelected(index0);
+    }
 }
 
 //----------------------------------------------------------------------------