| 46 | } |
| 47 | |
| 48 | void ProjectDelegate::paint(QPainter *painter, |
| 49 | const QStyleOptionViewItem &option, |
| 50 | const QModelIndex &index) const |
| 51 | { |
| 52 | QStyleOptionViewItem iOption = option; |
| 53 | if (d->index.isValid() && d->index == index) { |
| 54 | iOption.font.setBold(true); |
| 55 | d->spinner->move(option.rect.right() - 20, option.rect.top() + 4); |
| 56 | |
| 57 | if (index.data(Project::ParsingStateRole).value<Project::ParsingState>() == Project::Wait && !d->spinner->isVisible()) { |
| 58 | d->spinner->show(); |
| 59 | d->spinner->start(); |
| 60 | } else if (index.data(Project::ParsingStateRole).value<Project::ParsingState>() == Project::Done) { |
| 61 | d->spinner->hide(); |
| 62 | d->spinner->stop(); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | BaseItemDelegate::paint(painter, iOption, index); |
| 67 | } |
| 68 | |
| 69 | QSize ProjectDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const |
| 70 | { |