void MainUI::findPrev(){ PlainTextEditor *cur = currentEditor(); if(cur==0){ return; } bool found = cur->find( ui->line_find->text(), ui->tool_find_casesensitive->isChecked() ? QTextDocument::FindCaseSensitively | QTextDocument::FindBackward : QTextDocument::FindBackward ); if(!found){ //Try starting back at the bottom of the file cur->moveCursor(QTextCursor::End); cur->find( ui->line_find->text(), ui->tool_find_casesensitive->isChecked() ? QTextDocument::FindCaseSensitively | QTextDocument::FindBackward : QTextDocument::FindBackward ); } }
void MainUI::findNext(){ PlainTextEditor *cur = currentEditor(); if(cur==0){ return; } bool found = cur->find( ui->line_find->text(), ui->tool_find_casesensitive->isChecked() ? QTextDocument::FindCaseSensitively : QTextDocument::FindFlags() ); if(!found){ //Try starting back at the top of the file cur->moveCursor(QTextCursor::Start); cur->find( ui->line_find->text(), ui->tool_find_casesensitive->isChecked() ? QTextDocument::FindCaseSensitively : QTextDocument::FindFlags() ); } }