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

Method updateContent

src/frontend/datasources/OdsOptionsWidget.cpp:39–63  ·  view source on GitHub ↗

! * update the content of the preview using the filename * returns false when parsing fails (not an ODS file) */

Source from the content-addressed store, hash-verified

37 * returns false when parsing fails (not an ODS file)
38 */
39bool OdsOptionsWidget::updateContent(OdsFilter* filter, const QString& fileName) {
40 DEBUG(Q_FUNC_INFO)
41 ui.twDataRegions->clear();
42 auto* rootItem = ui.twDataRegions->invisibleRootItem();
43
44 if (! filter->parse(fileName, rootItem))
45 return false;
46
47 ui.twDataRegions->insertTopLevelItem(0, rootItem);
48 ui.twDataRegions->expandAll();
49
50 // select first sheet
51 if (ui.twDataRegions->selectedItems().isEmpty()) {
52 const auto* tli = ui.twDataRegions->topLevelItem(0);
53 for (int i = 0; i < tli->childCount(); i++) { // sheets
54 auto* sheet = tli->child(i);
55 if (sheet) {
56 ui.twDataRegions->setCurrentItem(sheet);
57 return true;
58 }
59 }
60 }
61
62 return true;
63}
64
65void OdsOptionsWidget::sheetSelectionChanged() {
66 DEBUG(Q_FUNC_INFO)

Callers

nothing calls this directly

Calls 7

expandAllMethod · 0.80
selectedItemsMethod · 0.80
clearMethod · 0.45
parseMethod · 0.45
isEmptyMethod · 0.45
childCountMethod · 0.45
childMethod · 0.45

Tested by

no test coverage detected