MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / hitScan

Method hitScan

launcher/ui/instanceview/VisualGroup.cpp:117–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117VisualGroup::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
142void VisualGroup::drawHeader(QPainter* painter, const QStyleOptionViewItem& option) const
143{

Callers 1

categoryAtMethod · 0.80

Calls 1

containsMethod · 0.45

Tested by

no test coverage detected