| 115 | } |
| 116 | |
| 117 | VisualGroup::HitResults VisualGroup::hitScan(const QPoint& pos) const |
| 118 | { |
| 119 | VisualGroup::HitResults results = VisualGroup::NoHit; |
| 120 | int y_start = verticalPosition(); |
| 121 | int body_start = y_start + headerHeight(); |
| 122 | int body_end = body_start + contentHeight(); |
| 123 | int y = pos.y(); |
| 124 | // int x = pos.x(); |
| 125 | if (y < y_start) { |
| 126 | results = VisualGroup::NoHit; |
| 127 | } else if (y < body_start) { |
| 128 | results = VisualGroup::HeaderHit; |
| 129 | int collapseSize = headerHeight() - 4; |
| 130 | |
| 131 | // the icon |
| 132 | QRect iconRect = QRect(view->m_leftMargin + 2, 2 + y_start, view->width() - 4, collapseSize); |
| 133 | if (iconRect.contains(pos)) { |
| 134 | results |= VisualGroup::CheckboxHit; |
| 135 | } |
| 136 | } else if (y < body_end) { |
| 137 | results |= VisualGroup::BodyHit; |
| 138 | } |
| 139 | return results; |
| 140 | } |
| 141 | |
| 142 | void VisualGroup::drawHeader(QPainter* painter, const QStyleOptionViewItem& option) const |
| 143 | { |