| 128 | } |
| 129 | |
| 130 | void ScriptManagerWidget::treeItemClicked(QTreeWidgetItem * item, int /*column*/) |
| 131 | { |
| 132 | if (item->type() == kScriptType) { |
| 133 | Tw::Scripting::ScriptObject * so = static_cast<Tw::Scripting::ScriptObject*>(item->data(0, Qt::UserRole).value<void*>()); |
| 134 | Tw::Scripting::Script * s = (so ? so->getScript() : nullptr); |
| 135 | if (s) { |
| 136 | s->setEnabled(item->checkState(0) == Qt::Checked); |
| 137 | setFolderCheckedState(item->parent()); |
| 138 | emit scriptListChanged(); |
| 139 | } |
| 140 | } |
| 141 | else if (item->type() == kFolderType) { |
| 142 | Qt::CheckState checked = item->checkState(0); |
| 143 | for (int i = 0; i < item->childCount(); ++i) { |
| 144 | item->child(i)->setCheckState(0, checked); |
| 145 | treeItemClicked(item->child(i), 0); |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | void ScriptManagerWidget::setFolderCheckedState(QTreeWidgetItem * item) |
| 151 | { |
nothing calls this directly
no test coverage detected