From 2d908b558ad5891f70fad05d59854782105d92a4 Mon Sep 17 00:00:00 2001 From: dt Date: Fri, 9 Apr 2010 18:46:34 +0200 Subject: Add text formatting to the TaskDelegate Reviewed-By: hunger --- src/plugins/projectexplorer/taskwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins/projectexplorer/taskwindow.cpp') diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 5b7d700e62..a26b27376f 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -122,7 +122,7 @@ public: int sizeOfLineNumber(); void setFileNotFound(const QModelIndex &index, bool b); - enum Roles { File = Qt::UserRole, Line, Description, FileNotFound, Type, Category }; + enum Roles { File = Qt::UserRole, Line, Description, FileNotFound, Type, Category, Task_t }; QIcon iconFor(Task::TaskType type); @@ -337,6 +337,8 @@ QVariant TaskModel::data(const QModelIndex &index, int role) const return (int)m_tasks.at(index.row()).type; } else if (role == TaskModel::Category) { return m_tasks.at(index.row()).category; + } else if (role == TaskModel::Task_t) { + return QVariant::fromValue(m_tasks.at(index.row())); } return QVariant(); } @@ -879,6 +881,7 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, int height = 0; description.replace('\n', QChar::LineSeparator); QTextLayout tl(description); + tl.setAdditionalFormats(index.data(TaskModel::Task_t).value().formats); tl.beginLayout(); while (true) { QTextLine line = tl.createLine(); -- cgit v1.2.1