##// END OF EJS Templates
Adds "unit" and "mission" columns to variable widget
Alexandre Leroux -
r519:873e4c155e63
parent child
Show More
@@ -16,7 +16,9 namespace {
16 const auto NAME_COLUMN = 0;
16 const auto NAME_COLUMN = 0;
17 const auto TSTART_COLUMN = 1;
17 const auto TSTART_COLUMN = 1;
18 const auto TEND_COLUMN = 2;
18 const auto TEND_COLUMN = 2;
19 const auto NB_COLUMNS = 3;
19 const auto UNIT_COLUMN = 3;
20 const auto MISSION_COLUMN = 4;
21 const auto NB_COLUMNS = 5;
20
22
21 // Column properties
23 // Column properties
22 const auto DEFAULT_HEIGHT = 25;
24 const auto DEFAULT_HEIGHT = 25;
@@ -34,10 +36,10 struct ColumnProperties {
34 int m_Height;
36 int m_Height;
35 };
37 };
36
38
37 const auto COLUMN_PROPERTIES
39 const auto COLUMN_PROPERTIES = QHash<int, ColumnProperties>{
38 = QHash<int, ColumnProperties>{{NAME_COLUMN, {QObject::tr("Name")}},
40 {NAME_COLUMN, {QObject::tr("Name")}}, {TSTART_COLUMN, {QObject::tr("tStart"), 180}},
39 {TSTART_COLUMN, {QObject::tr("tStart"), 180}},
41 {TEND_COLUMN, {QObject::tr("tEnd"), 180}}, {UNIT_COLUMN, {QObject::tr("Unit")}},
40 {TEND_COLUMN, {QObject::tr("tEnd"), 180}}};
42 {MISSION_COLUMN, {QObject::tr("Mission")}}};
41
43
42 /// Format for datetimes
44 /// Format for datetimes
43 const auto DATETIME_FORMAT = QStringLiteral("dd/MM/yyyy \nhh:mm:ss:zzz");
45 const auto DATETIME_FORMAT = QStringLiteral("dd/MM/yyyy \nhh:mm:ss:zzz");
@@ -163,6 +165,10 QVariant VariableModel::data(const QModelIndex &index, int role) const
163 return dateTimeVariant(variable->range().m_TStart);
165 return dateTimeVariant(variable->range().m_TStart);
164 case TEND_COLUMN:
166 case TEND_COLUMN:
165 return dateTimeVariant(variable->range().m_TEnd);
167 return dateTimeVariant(variable->range().m_TEnd);
168 case UNIT_COLUMN:
169 return variable->metadata().value(QStringLiteral("units"));
170 case MISSION_COLUMN:
171 return variable->metadata().value(QStringLiteral("mission"));
166 default:
172 default:
167 // No action
173 // No action
168 break;
174 break;
General Comments 0
You need to be logged in to leave comments. Login now