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

Method setNotebooks

src/frontend/dockwidgets/NotebookDock.cpp:31–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void NotebookDock::setNotebooks(QList<Notebook*> list) {
32 CONDITIONAL_LOCK_RETURN;
33 m_notebooks = list;
34 m_notebook = list.first();
35 setAspects(list);
36
37 // remove the available panel plugins first
38 int k = 0;
39 int prev_index = ui.tabWidget->currentIndex();
40 for (int i : index) {
41 ui.tabWidget->removeTab(i - k);
42 ++k;
43 }
44
45 ui.leName->setStyleSheet(QString());
46 ui.leName->setToolTip(QString());
47
48 if (m_notebooks.size() == 1) {
49 // show name/comment
50 ui.leName->setText(m_notebook->name());
51 ui.teComment->setText(m_notebook->comment());
52
53 // add available panel plugins
54 const auto& plugins = m_notebooks.first()->getPlugins();
55 index.clear();
56 for (auto* plugin : plugins) {
57 // skip the "File Browser" plugin
58 // in the new code of Cantor the plugin id is set as the object name and we can use it.
59 // for the older version we need to rely on the translated name...
60 // TODO: remove the dependency on the plugin name later.
61 if (plugin->objectName() == QLatin1String("FileBrowserPanel") || plugin->name() == i18n("File Browser"))
62 continue;
63
64 connect(plugin, &Cantor::PanelPlugin::visibilityRequested, this, &NotebookDock::visibilityRequested);
65 int i = ui.tabWidget->addTab(plugin->widget(), plugin->name());
66 index.append(i);
67
68 if (plugin->objectName() == QLatin1String("HelpPanel"))
69 m_helpPanelIndex = i;
70 else if (plugin->objectName() == QLatin1String("DocumentationPanel"))
71 m_documentationPanelIndex = i;
72 }
73 } else {
74 // don't show any name/comment when multiple notebooks were selected
75 ui.leName->setText(QString());
76 ui.teComment->setText(QString());
77 }
78
79 ui.tabWidget->setCurrentIndex(prev_index);
80
81 if (m_notebook->part()) {
82 ui.bEvaluate->show();
83 ui.bRestart->show();
84 } else {
85 ui.bEvaluate->hide();
86 ui.bRestart->hide();
87 }
88}

Callers 1

Calls 15

setToolTipMethod · 0.80
commentMethod · 0.80
getPluginsMethod · 0.80
appendMethod · 0.80
showMethod · 0.80
QStringClass · 0.50
currentIndexMethod · 0.45
removeTabMethod · 0.45
sizeMethod · 0.45
setTextMethod · 0.45
nameMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected