瀏覽代碼

Display "No description" rather than empty string in model view

(Thanks Andras Lasso!)
Steve Pieper 13 年之前
父節點
當前提交
7f586848d6
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      Libs/DICOM/Core/ctkDICOMModel.cpp

+ 10 - 1
Libs/DICOM/Core/ctkDICOMModel.cpp

@@ -497,7 +497,16 @@ QVariant ctkDICOMModel::data ( const QModelIndex & dataIndex, int role ) const
     // invalid).
     return QString();
     }
-  return d->value(parentIndex, dataIndex.row(), field);
+
+  QVariant dataValue=d->value(parentIndex, dataIndex.row(), field);
+  if (dataValue.isNull())
+  {
+    if (columnName.compare("Name")==0)
+    {
+      return QString("No description");
+    }
+  }
+  return dataValue;
 }
 
 //------------------------------------------------------------------------------