MCPcopy Create free account
hub / github.com/TeXworks/texworks / treeItemClicked

Method treeItemClicked

src/ScriptManagerWidget.cpp:130–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130void 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
150void ScriptManagerWidget::setFolderCheckedState(QTreeWidgetItem * item)
151{

Callers

nothing calls this directly

Calls 5

getScriptMethod · 0.80
setEnabledMethod · 0.80
parentMethod · 0.80
typeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected