MCPcopy Create free account
hub / github.com/commontk/CTK / isPointInCheckBox

Method isPointInCheckBox

Libs/Widgets/ctkCheckableHeaderView.cpp:336–359  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

334
335//-----------------------------------------------------------------------------
336bool ctkCheckableHeaderView::isPointInCheckBox(int section, QPoint pos)const
337{
338 QRect sectionRect = this->orientation() == Qt::Horizontal ?
339 QRect(this->sectionPosition(section), 0,
340 this->sectionSize(section), this->height()):
341 QRect(0, this->sectionPosition(section),
342 this->width(), this->sectionSize(section));
343 QStyleOptionHeader opt;
344 this->initStyleOption(&opt);
345 this->initStyleSectionOption(&opt, section, sectionRect);
346 QRect headerLabelRect = this->style()->subElementRect(QStyle::SE_HeaderLabel, &opt, this);
347 // from qcommonstyle.cpp:1541
348 if (opt.icon.isNull())
349 {
350 return false;
351 }
352 QPixmap pixmap
353 = opt.icon.pixmap(this->style()->pixelMetric(QStyle::PM_SmallIconSize),
354 (opt.state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled);
355 QRect aligned = this->style()->alignedRect(opt.direction, QFlag(opt.iconAlignment),
356 pixmap.size(), headerLabelRect);
357 QRect inter = aligned.intersected(headerLabelRect);
358 return inter.contains(pos);
359}
360
361//-----------------------------------------------------------------------------
362void ctkCheckableHeaderView::initStyleSectionOption(QStyleOptionHeader *option, int section, QRect rect)const

Callers 2

mousePressEventMethod · 0.95
mouseReleaseEventMethod · 0.95

Calls 11

subElementRectMethod · 0.80
orientationMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45
initStyleOptionMethod · 0.45
isNullMethod · 0.45
pixmapMethod · 0.45
pixelMetricMethod · 0.45
sizeMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected