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

Method SpreadsheetView

src/frontend/spreadsheet/SpreadsheetView.cpp:107–137  ·  view source on GitHub ↗

! \class SpreadsheetView \brief View class for Spreadsheet \ingroup frontend */

Source from the content-addressed store, hash-verified

105 \ingroup frontend
106*/
107SpreadsheetView::SpreadsheetView(Spreadsheet* spreadsheet, bool readOnly)
108 : QWidget()
109 , m_tableView(new QTableView(this))
110 , m_spreadsheet(spreadsheet)
111 , m_readOnly(readOnly) {
112 auto* layout = new QVBoxLayout(this);
113 layout->setContentsMargins(0, 0, 0, 0);
114
115 layout->addWidget(m_tableView);
116 if (m_readOnly)
117 m_tableView->setEditTriggers(QTableView::NoEditTriggers);
118
119 init();
120
121 // resize the view to show all columns and the first 10 rows.
122 // no need to resize the view when the project is being opened,
123 // all views will be resized to the stored values at the end
124 if (!m_spreadsheet->isLoading()) {
125 int w = m_tableView->verticalHeader()->width();
126 int h = m_horizontalHeader->height();
127 for (int i = 0; i < m_horizontalHeader->count(); ++i)
128 w += m_horizontalHeader->sectionSize(i);
129
130 if (m_tableView->verticalHeader()->count() <= 10)
131 h += m_tableView->verticalHeader()->sectionSize(0) * m_tableView->verticalHeader()->count();
132 else
133 h += m_tableView->verticalHeader()->sectionSize(0) * 11;
134
135 resize(w + 50, h);
136 }
137}
138
139SpreadsheetView::~SpreadsheetView() {
140}

Callers

nothing calls this directly

Calls 4

isLoadingMethod · 0.80
heightMethod · 0.80
widthMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected