diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/projectexplorer/task.cpp | 11 | ||||
-rw-r--r-- | src/plugins/projectexplorer/task.h | 3 | ||||
-rw-r--r-- | src/plugins/projectexplorer/taskhub.cpp | 4 | ||||
-rw-r--r-- | src/plugins/projectexplorer/taskmodel.cpp | 2 |
4 files changed, 14 insertions, 6 deletions
diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp index 045e461d43b..3ca1b969dae 100644 --- a/src/plugins/projectexplorer/task.cpp +++ b/src/plugins/projectexplorer/task.cpp @@ -67,7 +67,7 @@ Task::Task(TaskType type_, const QString &description, const QIcon &icon, Options options) : taskId(s_nextId), type(type_), options(options), summary(description), line(line_), movedLine(line_), category(category_), - icon(icon.isNull() ? taskTypeIcon(type_) : icon) + m_icon(icon) { ++s_nextId; setFile(file_); @@ -108,7 +108,7 @@ void Task::clear() line = -1; movedLine = -1; category = Utils::Id(); - icon = QIcon(); + m_icon = QIcon(); formats.clear(); m_mark.clear(); } @@ -133,6 +133,13 @@ QString Task::description() const return desc; } +QIcon Task::icon() const +{ + if (m_icon.isNull()) + m_icon = taskTypeIcon(type); + return m_icon; +} + // // functions // diff --git a/src/plugins/projectexplorer/task.h b/src/plugins/projectexplorer/task.h index 9c991179777..61aa31e4fce 100644 --- a/src/plugins/projectexplorer/task.h +++ b/src/plugins/projectexplorer/task.h @@ -74,6 +74,7 @@ public: void clear(); void setFile(const Utils::FilePath &file); QString description() const; + QIcon icon() const; unsigned int taskId = 0; TaskType type = Unknown; @@ -85,7 +86,6 @@ public: int line = -1; int movedLine = -1; // contains a line number if the line was moved in the editor Utils::Id category; - QIcon icon; // Having a container of QTextLayout::FormatRange in Task isn't that great // It would be cleaner to split up the text into @@ -101,6 +101,7 @@ private: void setMark(TextEditor::TextMark *mark); QSharedPointer<TextEditor::TextMark> m_mark; + mutable QIcon m_icon; static unsigned int s_nextId; friend class TaskHub; diff --git a/src/plugins/projectexplorer/taskhub.cpp b/src/plugins/projectexplorer/taskhub.cpp index d2528d955c6..856959ed0a2 100644 --- a/src/plugins/projectexplorer/taskhub.cpp +++ b/src/plugins/projectexplorer/taskhub.cpp @@ -78,8 +78,8 @@ public: } else { setToolTip(task.description()); } - setIcon(task.icon); - setVisible(!task.icon.isNull()); + setIcon(task.icon()); + setVisible(!task.icon().isNull()); } bool isClickable() const override; diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp index 7dc9f66b533..a52f2ff3ac6 100644 --- a/src/plugins/projectexplorer/taskmodel.cpp +++ b/src/plugins/projectexplorer/taskmodel.cpp @@ -255,7 +255,7 @@ QVariant TaskModel::data(const QModelIndex &index, int role) const else if (role == TaskModel::Category) return m_tasks.at(index.row()).category.uniqueIdentifier(); else if (role == TaskModel::Icon) - return m_tasks.at(index.row()).icon; + return m_tasks.at(index.row()).icon(); else if (role == TaskModel::Task_t) return QVariant::fromValue(task(index)); return QVariant(); |