-----------------------------------------------------------------------------
| 334 | |
| 335 | //----------------------------------------------------------------------------- |
| 336 | bool 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 | //----------------------------------------------------------------------------- |
| 362 | void ctkCheckableHeaderView::initStyleSectionOption(QStyleOptionHeader *option, int section, QRect rect)const |
no test coverage detected