MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / SetCheckState

Method SetCheckState

Src/CheckBoxHeader.cpp:20–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20void 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
45Qt::CheckState CCheckBoxHeader::GetCheckState(int index) const
46{

Callers

nothing calls this directly

Calls 2

isCheckableMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected