Changeset View
Changeset View
Standalone View
Standalone View
ui/toc.cpp
Context not available. | |||||
187 | emit rightClick(viewport, e->globalPos(), m_model->data(index).toString()); | 187 | emit rightClick(viewport, e->globalPos(), m_model->data(index).toString()); | ||
---|---|---|---|---|---|
188 | } | 188 | } | ||
189 | 189 | | |||
190 | void TOC::expandRecursively() | ||||
191 | { | ||||
192 | QList<QModelIndex> worklist = { m_treeView->currentIndex() }; | ||||
193 | if (!worklist[0].isValid()) { | ||||
194 | return; | ||||
195 | } | ||||
196 | while (!worklist.isEmpty()) { | ||||
197 | QModelIndex index = worklist.takeLast(); | ||||
198 | m_treeView->expand(index); | ||||
199 | for (int i = 0; i < m_model->rowCount(index); i++) { | ||||
200 | worklist += m_model->index(i, 0, index); | ||||
201 | } | ||||
202 | } | ||||
203 | } | ||||
204 | | ||||
205 | void TOC::collapseRecursively() | ||||
206 | { | ||||
207 | QList<QModelIndex> worklist = { m_treeView->currentIndex() }; | ||||
208 | if (!worklist[0].isValid()) { | ||||
209 | return; | ||||
210 | } | ||||
211 | while (!worklist.isEmpty()) { | ||||
212 | QModelIndex index = worklist.takeLast(); | ||||
213 | m_treeView->collapse(index); | ||||
214 | for (int i = 0; i < m_model->rowCount(index); i++) { | ||||
215 | worklist += m_model->index(i, 0, index); | ||||
216 | } | ||||
217 | } | ||||
218 | } | ||||
219 | | ||||
220 | void TOC::expandAll() | ||||
221 | { | ||||
222 | m_treeView->expandAll(); | ||||
223 | } | ||||
224 | | ||||
225 | void TOC::collapseAll() | ||||
226 | { | ||||
227 | m_treeView->collapseAll(); | ||||
228 | } | ||||
229 | | ||||
190 | #include "moc_toc.cpp" | 230 | #include "moc_toc.cpp" | ||
Context not available. |