@@ -12,7 +12,7 | |||
|
12 | 12 | |
|
13 | 13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableModel) |
|
14 | 14 | |
|
15 |
enum VariableRoles { |
|
|
15 | enum VariableRoles { ProgressRole = Qt::UserRole }; | |
|
16 | 16 | |
|
17 | 17 | |
|
18 | 18 | class IDataSeries; |
@@ -50,7 +50,7 struct VariableModel::VariableModelPrivate { | |||
|
50 | 50 | std::unordered_map<std::shared_ptr<Variable>, double> m_VariableToProgress; |
|
51 | 51 | |
|
52 | 52 | |
|
53 | /// Return te row index of the variable | |
|
53 | /// Return the row index of the variable. -1 if it's not found | |
|
54 | 54 | int indexOfVariable(Variable *variable) const noexcept; |
|
55 | 55 | }; |
|
56 | 56 | |
@@ -169,7 +169,7 QVariant VariableModel::data(const QModelIndex &index, int role) const | |||
|
169 | 169 | qWarning(LOG_VariableModel()) << tr("Can't get data (no variable)"); |
|
170 | 170 | } |
|
171 | 171 | } |
|
172 |
else if (role == VariableRoles:: |
|
|
172 | else if (role == VariableRoles::ProgressRole) { | |
|
173 | 173 | if (auto variable = impl->m_Variables.at(index.row())) { |
|
174 | 174 | |
|
175 | 175 | auto it = impl->m_VariableToProgress.find(variable); |
@@ -17,13 +17,13 Q_LOGGING_CATEGORY(LOG_VariableInspectorWidget, "VariableInspectorWidget") | |||
|
17 | 17 | class QProgressBarItemDelegate : public QStyledItemDelegate { |
|
18 | 18 | |
|
19 | 19 | public: |
|
20 |
QProgressBarItemDelegate(QObject *parent) : QStyledItemDelegate |
|
|
20 | QProgressBarItemDelegate(QObject *parent) : QStyledItemDelegate{parent} {} | |
|
21 | 21 | |
|
22 | 22 | void paint(QPainter *painter, const QStyleOptionViewItem &option, |
|
23 | 23 | const QModelIndex &index) const |
|
24 | 24 | { |
|
25 | 25 | auto data = index.data(Qt::DisplayRole); |
|
26 |
auto progressData = index.data(VariableRoles:: |
|
|
26 | auto progressData = index.data(VariableRoles::ProgressRole); | |
|
27 | 27 | if (data.isValid() && progressData.isValid()) { |
|
28 | 28 | auto name = data.value<QString>(); |
|
29 | 29 | auto progress = progressData.value<double>(); |
@@ -51,7 +51,7 public: | |||
|
51 | 51 | VariableInspectorWidget::VariableInspectorWidget(QWidget *parent) |
|
52 | 52 | : QWidget{parent}, |
|
53 | 53 | ui{new Ui::VariableInspectorWidget}, |
|
54 |
m_ProgressBarItemDelegate{new QProgressBarItemDelegate |
|
|
54 | m_ProgressBarItemDelegate{new QProgressBarItemDelegate{this}} | |
|
55 | 55 | { |
|
56 | 56 | ui->setupUi(this); |
|
57 | 57 |
General Comments 0
You need to be logged in to leave comments.
Login now