Sfoglia il codice sorgente

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

Neal Wilson 11 anni fa
parent
commit
b52ac937db
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6
    0
      src/typica.w

+ 6
- 0
src/typica.w Vedi File

@@ -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…
Annulla
Salva