Przeglądaj źródła

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

Neal Wilson 11 lat temu
rodzic
commit
b52ac937db
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6
    0
      src/typica.w

+ 6
- 0
src/typica.w Wyświetl plik

@@ -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());

Ładowanie…
Anuluj
Zapisz