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

Method updateGUI

src/frontend/MainWin.cpp:1067–1282  ·  view source on GitHub ↗

* updates the state of actions, menus and toolbars (enabled or disabled) * depending on the currently active window (worksheet or spreadsheet). */

Source from the content-addressed store, hash-verified

1065 * depending on the currently active window (worksheet or spreadsheet).
1066 */
1067void MainWin::updateGUI() {
1068 if (!m_project || m_project->isLoading())
1069 return;
1070
1071 if (m_closing || m_projectClosing)
1072 return;
1073
1074#ifdef HAVE_TOUCHBAR
1075 // reset the touchbar
1076 m_touchBar->clear();
1077 m_touchBar->addAction(m_undoIconOnlyAction);
1078 m_touchBar->addAction(m_redoIconOnlyAction);
1079 m_touchBar->addSeparator();
1080#endif
1081
1082 auto* factory = this->guiFactory();
1083 if (!m_dockManagerContent || !m_dockManagerContent->focusedDockWidget()) {
1084 factory->container(QLatin1String("spreadsheet"), this)->setEnabled(false);
1085 factory->container(QLatin1String("matrix"), this)->setEnabled(false);
1086 factory->container(QLatin1String("worksheet"), this)->setEnabled(false);
1087 factory->container(QLatin1String("datapicker"), this)->setEnabled(false);
1088 factory->container(QLatin1String("spreadsheet_toolbar"), this)->hide();
1089 factory->container(QLatin1String("worksheet_toolbar"), this)->hide();
1090 factory->container(QLatin1String("cartesian_plot_toolbar"), this)->hide();
1091 factory->container(QLatin1String("datapicker_toolbar"), this)->hide();
1092#ifdef HAVE_CANTOR_LIBS
1093 factory->container(QLatin1String("notebook"), this)->setEnabled(false);
1094 factory->container(QLatin1String("notebook_toolbar"), this)->hide();
1095#endif
1096 m_printAction->setEnabled(false);
1097 m_printPreviewAction->setEnabled(false);
1098 m_exportAction->setEnabled(false);
1099 return;
1100 } else {
1101 m_printAction->setEnabled(true);
1102 m_printPreviewAction->setEnabled(true);
1103 m_exportAction->setEnabled(true);
1104 }
1105
1106#ifdef HAVE_TOUCHBAR
1107 if (dynamic_cast<Folder*>(m_currentAspect)) {
1108 m_touchBar->addAction(m_newWorksheetAction);
1109 m_touchBar->addAction(m_newSpreadsheetAction);
1110 m_touchBar->addAction(m_newMatrixAction);
1111 }
1112#endif
1113
1114 Q_ASSERT(m_currentAspect);
1115
1116 // Handle the Worksheet-object
1117 const auto* w = dynamic_cast<Worksheet*>(m_currentAspect);
1118 if (!w)
1119 w = dynamic_cast<Worksheet*>(m_currentAspect->parent(AspectType::Worksheet));
1120
1121 if (w) {
1122 bool update = false;
1123 if (w != m_lastWorksheet) {
1124 m_lastWorksheet = w;

Callers

nothing calls this directly

Calls 15

activeSpreadsheetMethod · 0.95
hasActionFunction · 0.85
isLoadingMethod · 0.80
addSeparatorMethod · 0.80
containerMethod · 0.80
parentAspectMethod · 0.80
clearMethod · 0.45
focusedDockWidgetMethod · 0.45
setEnabledMethod · 0.45
parentMethod · 0.45
viewMethod · 0.45

Tested by

no test coverage detected