| 18 | } |
| 19 | |
| 20 | void CCheckBoxHeader::SetCheckState(int index, Qt::CheckState state) |
| 21 | { |
| 22 | QStandardItemModel* pModel = qobject_cast<QStandardItemModel*>(this->model()); |
| 23 | if(pModel) { |
| 24 | QStandardItem* item = nullptr; |
| 25 | if(orientation() == Qt::Horizontal) |
| 26 | item = pModel->horizontalHeaderItem(index); |
| 27 | else |
| 28 | item = pModel->verticalHeaderItem(index); |
| 29 | if(item && item->isCheckable()) { |
| 30 | item->setCheckState(state); |
| 31 | viewport()->update(); |
| 32 | return; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | if(!m_CheckableSections.contains(index)) { |
| 37 | qCritical(log) << "Please call SetCheckable first to enable the checkbox"; |
| 38 | return; |
| 39 | } |
| 40 | if (m_CheckableSections[index] == state) return; |
| 41 | m_CheckableSections[index] = state; |
| 42 | viewport()->update(); |
| 43 | } |
| 44 | |
| 45 | Qt::CheckState CCheckBoxHeader::GetCheckState(int index) const |
| 46 | { |
nothing calls this directly
no test coverage detected