MCPcopy Create free account
hub / github.com/KDE/labplot / refreshPreview

Method refreshPreview

src/frontend/datasources/ImportProjectDialog.cpp:321–356  ·  view source on GitHub ↗

! * show the content of the project in the tree view */

Source from the content-addressed store, hash-verified

319 * show the content of the project in the tree view
320 */
321void ImportProjectDialog::refreshPreview() {
322 const QString& project = m_cbFileName->currentText();
323 m_projectParser->setProjectFileName(project);
324
325#ifdef HAVE_LIBORIGIN
326 if (m_projectType == ProjectType::Origin) {
327 auto* originParser = reinterpret_cast<OriginProjectParser*>(m_projectParser);
328 bool hasUnusedObjects = false;
329 bool hasMultiLayerGraphs = false;
330 originParser->checkContent(hasUnusedObjects, hasMultiLayerGraphs);
331
332 ui.lUnusedObjects->setVisible(hasUnusedObjects);
333 ui.chbUnusedObjects->setVisible(hasUnusedObjects);
334 originParser->setImportUnusedObjects(hasUnusedObjects && ui.chbUnusedObjects->isChecked());
335
336 ui.lGraphLayer->setVisible(hasMultiLayerGraphs);
337 ui.cbGraphLayer->setVisible(hasMultiLayerGraphs);
338 }
339#endif
340
341 delete ui.tvPreview->model();
342 ui.tvPreview->setModel(m_projectParser->model());
343 connect(ui.tvPreview->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ImportProjectDialog::selectionChanged);
344
345 // show top-level containers only
346 if (ui.tvPreview->model()) {
347 QModelIndex root = ui.tvPreview->model()->index(0, 0);
348 showTopLevelOnly(root);
349 }
350
351 // select the first top-level node and
352 // expand the tree to show all available top-level objects and adjust the header sizes
353 ui.tvPreview->setCurrentIndex(ui.tvPreview->model()->index(0, 0));
354 ui.tvPreview->expandAll();
355 ui.tvPreview->header()->resizeSections(QHeaderView::ResizeToContents);
356}
357
358/*!
359 Hides the non-toplevel items of the model used in the tree view.

Callers

nothing calls this directly

Calls 11

currentTextMethod · 0.80
checkContentMethod · 0.80
selectionModelMethod · 0.80
expandAllMethod · 0.80
setProjectFileNameMethod · 0.45
setVisibleMethod · 0.45
modelMethod · 0.45
setModelMethod · 0.45
indexMethod · 0.45
setCurrentIndexMethod · 0.45

Tested by

no test coverage detected