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

Method initConnectionsRowCountChanges

src/backend/spreadsheet/Spreadsheet.cpp:119–150  ·  view source on GitHub ↗

! * connects to the signals emitted in the first column to react on the row count changes that are * done internally in Column and to emit the corresponding signals in Spreadsheet. * called initially and on column count changes (columns inserts/removals). */

Source from the content-addressed store, hash-verified

117 * called initially and on column count changes (columns inserts/removals).
118 */
119void Spreadsheet::initConnectionsRowCountChanges() {
120 if (columnCount() == 0)
121 return;
122
123 // check first if the first column was changed
124 Q_D(Spreadsheet);
125 auto* firstColumn = children<Column>().first();
126 if (d->firstColumn == firstColumn)
127 return;
128 else {
129 disconnect(d->firstColumn, nullptr, this, nullptr);
130 d->firstColumn = firstColumn;
131 }
132
133 // handle row insertions
134 connect(d->firstColumn, &AbstractColumn::rowsAboutToBeInserted, this, [=](const AbstractColumn*, int before, int count) {
135 Q_EMIT rowsAboutToBeInserted(before, before + count - 1);
136 });
137 connect(d->firstColumn, &AbstractColumn::rowsInserted, this, [=](const AbstractColumn* sender, int, int) {
138 Q_EMIT rowsInserted(sender->rowCount());
139 Q_EMIT rowCountChanged(sender->rowCount());
140 });
141
142 // handle row removals
143 connect(d->firstColumn, &AbstractColumn::rowsAboutToBeRemoved, this, [=](const AbstractColumn*, int first, int count) {
144 Q_EMIT rowsAboutToBeRemoved(first, first + count - 1);
145 });
146 connect(d->firstColumn, &AbstractColumn::rowsRemoved, this, [=](const AbstractColumn* sender, int, int) {
147 Q_EMIT rowsRemoved(sender->rowCount());
148 Q_EMIT rowCountChanged(sender->rowCount());
149 });
150}
151
152void Spreadsheet::setSuppressSetCommentFinalizeImport(bool suppress) {
153 Q_D(Spreadsheet);

Callers

nothing calls this directly

Calls 2

columnCountFunction · 0.85
rowCountMethod · 0.45

Tested by

no test coverage detected