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

Method activeSpreadsheet

src/frontend/MainWin.cpp:2036–2054  ·  view source on GitHub ↗

! returns a pointer to a \c Spreadsheet object, if the currently active Mdi-Subwindow or if the currently selected tab in a \c WorkbookView is a \c SpreadsheetView Otherwise returns \c 0. */

Source from the content-addressed store, hash-verified

2034 Otherwise returns \c 0.
2035*/
2036Spreadsheet* MainWin::activeSpreadsheet() const {
2037 // if (dynamic_cast<QQuickWidget*>(centralWidget()))
2038 // return nullptr;
2039
2040 if (!m_currentAspect)
2041 return nullptr;
2042
2043 Spreadsheet* spreadsheet = nullptr;
2044 if (m_currentAspect->type() == AspectType::Spreadsheet)
2045 spreadsheet = dynamic_cast<Spreadsheet*>(m_currentAspect);
2046 else {
2047 // check whether one of spreadsheet columns is selected and determine the spreadsheet
2048 auto* parent = m_currentAspect->parentAspect();
2049 if (parent && parent->type() == AspectType::Spreadsheet)
2050 spreadsheet = dynamic_cast<Spreadsheet*>(parent);
2051 }
2052
2053 return spreadsheet;
2054}
2055
2056#ifdef HAVE_CANTOR_LIBS
2057/*

Callers 1

updateGUIMethod · 0.95

Calls 2

parentAspectMethod · 0.80
typeMethod · 0.45

Tested by

no test coverage detected