@@ -6,6 +6,10 Q_LOGGING_CATEGORY(LOG_VariableModel, "VariableModel") | |||
|
6 | 6 | |
|
7 | 7 | namespace { |
|
8 | 8 | |
|
9 | // Column indexes | |
|
10 | const auto NAME_COLUMN = 0; | |
|
11 | const auto UNIT_COLUMN = 1; | |
|
12 | const auto MISSION_COLUMN = 2; | |
|
9 | 13 | const auto NB_COLUMNS = 3; |
|
10 | 14 | |
|
11 | 15 | } // namespace |
@@ -51,6 +55,26 QVariant VariableModel::data(const QModelIndex &index, int role) const | |||
|
51 | 55 | |
|
52 | 56 | QVariant VariableModel::headerData(int section, Qt::Orientation orientation, int role) const |
|
53 | 57 | { |
|
58 | if (role != Qt::DisplayRole) { | |
|
59 | return QVariant{}; | |
|
60 | } | |
|
61 | ||
|
62 | if (orientation == Qt::Horizontal) { | |
|
63 | switch (section) { | |
|
64 | case NAME_COLUMN: | |
|
65 | return tr("Name"); | |
|
66 | case UNIT_COLUMN: | |
|
67 | return tr("Unit"); | |
|
68 | case MISSION_COLUMN: | |
|
69 | return tr("Mission"); | |
|
70 | default: | |
|
71 | // No action | |
|
72 | break; | |
|
73 | } | |
|
74 | ||
|
75 | qWarning(LOG_VariableModel()) | |
|
76 | << tr("Can't get header data (unknown column %1)").arg(section); | |
|
77 | } | |
|
54 | 78 | |
|
55 | 79 | return QVariant{}; |
|
56 | 80 | } |
General Comments 0
You need to be logged in to leave comments.
Login now