| 73 | } |
| 74 | |
| 75 | QVariant ExpandingWidgetModel::data(const QModelIndex& index, int role) const |
| 76 | { |
| 77 | switch (role) { |
| 78 | case Qt::BackgroundRole: |
| 79 | { |
| 80 | if (index.column() == 0) { |
| 81 | //Highlight by match-quality |
| 82 | uint color = matchColor(index); |
| 83 | if (color) { |
| 84 | return QBrush(color); |
| 85 | } |
| 86 | } |
| 87 | //Use a special background-color for expanded items |
| 88 | if (isExpanded(index)) { |
| 89 | if (index.row() & 1) { |
| 90 | return doAlternate(treeView()->palette().toolTipBase().color()); |
| 91 | } else { |
| 92 | return treeView()->palette().toolTipBase(); |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | return QVariant(); |
| 98 | } |
| 99 | |
| 100 | QModelIndex ExpandingWidgetModel::mapFromSource(const QModelIndex& index) const |
| 101 | { |