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

Method showSearchReplace

src/frontend/spreadsheet/SpreadsheetView.cpp:3504–3527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3502}
3503
3504void SpreadsheetView::showSearchReplace(bool replace) {
3505 if (!m_searchReplaceWidget) {
3506 m_searchReplaceWidget = new SearchReplaceWidget(m_spreadsheet, this);
3507 static_cast<QVBoxLayout*>(this->layout())->addWidget(m_searchReplaceWidget);
3508 }
3509
3510 m_searchReplaceWidget->setReplaceEnabled(replace);
3511
3512 const auto& indexes = m_tableView->selectionModel()->selectedIndexes();
3513 if (!indexes.isEmpty()) {
3514 const auto& firstIndex = indexes.constFirst();
3515 const auto* column = m_spreadsheet->column(firstIndex.column());
3516 const int row = firstIndex.row();
3517 m_searchReplaceWidget->setInitialPattern(column->columnMode(), column->asStringColumn()->textAt(row));
3518 }
3519
3520 m_searchReplaceWidget->show();
3521
3522 // interrupt the event loop to show/render the widget first and set the focus
3523 // after this otherwise the focus in the search field is not set
3524 QTimer::singleShot(0, this, [=]() {
3525 m_searchReplaceWidget->setFocus();
3526 });
3527}
3528
3529/*!
3530 * sorts the selected columns separately of each other in ascending order.

Callers

nothing calls this directly

Calls 11

setReplaceEnabledMethod · 0.80
selectionModelMethod · 0.80
setInitialPatternMethod · 0.80
asStringColumnMethod · 0.80
showMethod · 0.80
isEmptyMethod · 0.45
columnMethod · 0.45
rowMethod · 0.45
columnModeMethod · 0.45
textAtMethod · 0.45
setFocusMethod · 0.45

Tested by

no test coverage detected