Auto status change to "Under Review"
@@ -50,6 +50,38 int VariableModel::rowCount(const QModelIndex &parent) const | |||||
50 |
|
50 | |||
51 | QVariant VariableModel::data(const QModelIndex &index, int role) const |
|
51 | QVariant VariableModel::data(const QModelIndex &index, int role) const | |
52 | { |
|
52 | { | |
|
53 | if (!index.isValid()) { | |||
|
54 | return QVariant{}; | |||
|
55 | } | |||
|
56 | ||||
|
57 | if (index.row() < 0 || index.row() >= rowCount()) { | |||
|
58 | return QVariant{}; | |||
|
59 | } | |||
|
60 | ||||
|
61 | if (role == Qt::DisplayRole) { | |||
|
62 | const auto &variable = impl->m_Variables.at(index.row()); | |||
|
63 | ||||
|
64 | if (variable) { | |||
|
65 | switch (index.column()) { | |||
|
66 | case NAME_COLUMN: | |||
|
67 | return variable->m_Name; | |||
|
68 | case UNIT_COLUMN: | |||
|
69 | return variable->m_Unit; | |||
|
70 | case MISSION_COLUMN: | |||
|
71 | return variable->m_Mission; | |||
|
72 | default: | |||
|
73 | // No action | |||
|
74 | break; | |||
|
75 | } | |||
|
76 | ||||
|
77 | qWarning(LOG_VariableModel()) | |||
|
78 | << tr("Can't get data (unknown column %1)").arg(index.column()); | |||
|
79 | } | |||
|
80 | else { | |||
|
81 | qWarning(LOG_VariableModel()) << tr("Can't get data (no variable)"); | |||
|
82 | } | |||
|
83 | } | |||
|
84 | ||||
53 | return QVariant{}; |
|
85 | return QVariant{}; | |
54 | } |
|
86 | } | |
55 |
|
87 |
General Comments 4
Pull request updated. Auto status change to "Under Review"
Changed commits: * 1 added * 0 removed Changed files: * M core/src/Variable/VariableModel.cpp
Status change > Approved
You need to be logged in to leave comments.
Login now