瀏覽代碼

Allow retrieval of original measurement data from MeasurementModel through Qt::UserRole

Neal Wilson 11 年之前
父節點
當前提交
b52ac937db
共有 1 個檔案被更改,包括 6 行新增0 行删除
  1. 6
    0
      src/typica.w

+ 6
- 0
src/typica.w 查看文件

@@ -9390,6 +9390,8 @@ same thing. Views will request the display role for presenting the information
9390 9390
 to the user, but they will request the edit role if the user attempts to modify
9391 9391
 the data through a view.
9392 9392
 
9393
+As of version 1.6, |Qt::UserRole| allows retrieval of raw measurement data.
9394
+
9393 9395
 @<MeasurementModel Implementation@>=
9394 9396
 QVariant MeasurementModel::data(const QModelIndex &index, int role) const@/
9395 9397
 {@/
@@ -9398,6 +9400,10 @@ QVariant MeasurementModel::data(const QModelIndex &index, int role) const@/
9398 9400
 	{
9399 9401
 		return QVariant();
9400 9402
 	}
9403
+	if(role == Qt::UserRole)
9404
+	{
9405
+		return QVariant(row->at(column));
9406
+	}
9401 9407
 	if(role == Qt::DisplayRole || role == Qt::EditRole)
9402 9408
 	{
9403 9409
 		MeasurementList *row = entries->at(index.row());

Loading…
取消
儲存