Browse Source

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

Neal Wilson 11 years ago
parent
commit
b52ac937db
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      src/typica.w

+ 6
- 0
src/typica.w View File

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

Loading…
Cancel
Save