MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / getChildCheckState

Method getChildCheckState

ElaWidgetToolsExample/ModelView/T_TreeItem.cpp:48–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48Qt::CheckState T_TreeItem::getChildCheckState()
49{
50 bool isAllChecked = true;
51 bool isAnyChecked = false;
52 for (auto node : _pChildrenItems)
53 {
54 if (node->getIsChecked())
55 {
56 isAnyChecked = true;
57 }
58 else
59 {
60 isAllChecked = false;
61 }
62 Qt::CheckState childState = node->getChildCheckState();
63 if (childState == Qt::PartiallyChecked)
64 {
65 isAllChecked = false;
66 isAnyChecked = true;
67 break;
68 }
69 else if (childState == Qt::Unchecked)
70 {
71 isAllChecked = false;
72 }
73 }
74 if (_pChildrenItems.count() > 0)
75 {
76 if (isAllChecked)
77 {
78 return Qt::Checked;
79 }
80 if (isAnyChecked)
81 {
82 return Qt::PartiallyChecked;
83 }
84 return Qt::Unchecked;
85 }
86 return Qt::Checked;
87}
88
89void T_TreeItem::appendChildItem(T_TreeItem* childItem)
90{

Callers 1

dataMethod · 0.80

Calls 1

countMethod · 0.80

Tested by

no test coverage detected