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

Method findNext

src/frontend/spreadsheet/SearchReplaceWidget.cpp:733–891  ·  view source on GitHub ↗

advanced and data type specific find functions

Source from the content-addressed store, hash-verified

731// **** advanced and data type specific find functions ****
732// **********************************************************
733bool SearchReplaceWidget::findNext(bool proceed, bool findAndReplace) {
734 // search pattern(s)
735 const auto type = static_cast<DataType>(uiSearchReplace.cbDataType->currentIndex());
736 QString pattern1;
737 QString pattern2;
738 QString replaceValue;
739 switch (type) {
740 case DataType::Text:
741 pattern1 = uiSearchReplace.cbValueText->currentText();
742 addCurrentTextToHistory(uiSearchReplace.cbValueText);
743 if (findAndReplace) {
744 replaceValue = uiSearchReplace.cbReplaceText->currentText();
745 addCurrentTextToHistory(uiSearchReplace.cbReplaceText);
746 }
747 break;
748 case DataType::Numeric:
749 pattern1 = uiSearchReplace.cbValue1->currentText();
750 pattern2 = uiSearchReplace.cbValue2->currentText();
751 addCurrentTextToHistory(uiSearchReplace.cbValue1);
752 addCurrentTextToHistory(uiSearchReplace.cbValue2);
753 if (findAndReplace) {
754 replaceValue = uiSearchReplace.cbReplace->currentText();
755 addCurrentTextToHistory(uiSearchReplace.cbReplace);
756 }
757 break;
758 case DataType::DateTime:
759 pattern1 = uiSearchReplace.dteValue1->text();
760 pattern2 = uiSearchReplace.dteValue2->text();
761 if (findAndReplace)
762 replaceValue = uiSearchReplace.dteReplace->text();
763 break;
764 }
765
766 if (pattern1.isEmpty()) {
767 highlight(type, false);
768 return true;
769 }
770
771 if (findAndReplace && replaceValue.isEmpty())
772 return false;
773
774 // settings
775 const auto opText = static_cast<OperatorText>(uiSearchReplace.cbOperatorText->currentData().toInt());
776 const auto opNumeric = static_cast<Operator>(uiSearchReplace.cbOperator->currentData().toInt());
777 const auto opDateTime = static_cast<Operator>(uiSearchReplace.cbOperatorDateTime->currentData().toInt());
778 const auto cs = uiSearchReplace.tbMatchCase->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive;
779 const bool columnMajor = (uiSearchReplace.cbOrder->currentIndex() == 0);
780
781 // spreadsheet size and the start cell
782 const int colCount = m_spreadsheet->columnCount();
783 const int rowCount = m_spreadsheet->rowCount();
784 int curRow = m_view->firstSelectedRow();
785 int curCol = m_view->firstSelectedColumn();
786
787 if (columnMajor && proceed) {
788 if (curRow != rowCount - 1)
789 ++curRow; // not the last row yet, navigate to the next row
790 else {

Callers 4

testSearchExtended00Method · 0.80
testSearchExtended01Method · 0.80
testSearchExtended02Method · 0.80
testSearchExtended03Method · 0.80

Calls 9

currentTextMethod · 0.80
currentIndexMethod · 0.45
textMethod · 0.45
isEmptyMethod · 0.45
columnCountMethod · 0.45
rowCountMethod · 0.45
firstSelectedRowMethod · 0.45
firstSelectedColumnMethod · 0.45
goToCellMethod · 0.45

Tested by 4

testSearchExtended00Method · 0.64
testSearchExtended01Method · 0.64
testSearchExtended02Method · 0.64
testSearchExtended03Method · 0.64