- Timestamp:
- Jun 9, 2023, 2:08:42 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bnchlpdlg.cpp
r10082 r10087 41 41 #include <QHBoxLayout> 42 42 #include <QVBoxLayout> 43 43 #include <iostream> 44 44 #include "bnchlpdlg.h" 45 45 #include "bnchtml.h" … … 140 140 141 141 QString text = _what->text(); 142 142 143 Qt::CaseSensitivity cs = _cbCase->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive; 143 144 … … 156 157 void bncHlpDlg::slotFindNext(const QString& str, Qt::CaseSensitivity cs) { 157 158 QString searchString = str; 158 bool found = false;159 159 QTextDocument::FindFlags flags; 160 160 flags |= QTextDocument::FindWholeWords; … … 163 163 } 164 164 165 if (!_hlCursor.atEnd()) { 166 _hlCursor = (_tb->document()->find(searchString, _hlCursor, flags)); 167 if (!_hlCursor.isNull()) { 168 found = true; 169 _hlCursor.movePosition(QTextCursor::WordRight, QTextCursor::KeepAnchor); 170 _tb->setTextCursor(_hlCursor); 171 } 172 } 173 174 if (found == false) { 175 _hlCursor.movePosition(QTextCursor::Start, QTextCursor::KeepAnchor); 165 _hlCursor = (_tb->document()->find(searchString, _hlCursor, flags)); 166 if (!_hlCursor.isNull()) { 167 _hlCursor.movePosition(QTextCursor::WordRight, QTextCursor::KeepAnchor); 168 _tb->setTextCursor(_hlCursor); 169 } 170 else { 171 _hlCursor.movePosition(QTextCursor::Start); 176 172 _tb->setTextCursor(_hlCursor); 177 173 } … … 182 178 void bncHlpDlg::slotFindPrev(const QString& str, Qt::CaseSensitivity cs) { 183 179 QString searchString = str; 184 bool found = false;185 180 QTextDocument::FindFlags flags; 186 181 flags |= QTextDocument::FindWholeWords; … … 190 185 } 191 186 192 if (!_hlCursor.atEnd()) { 193 _hlCursor = (_tb->document()->find(searchString, _hlCursor, flags)); 194 if (!_hlCursor.isNull()) { 195 found = true; 196 _hlCursor.movePosition(QTextCursor::WordRight, QTextCursor::KeepAnchor); 197 _tb->setTextCursor(_hlCursor); 198 } 199 } 200 201 if (found == false) { 202 _hlCursor.movePosition(QTextCursor::Start, QTextCursor::KeepAnchor); 203 _tb->setTextCursor(_hlCursor); 204 } 205 } 206 207 208 209 210 187 _hlCursor = (_tb->document()->find(searchString, _hlCursor, flags)); 188 if (!_hlCursor.isNull()) { 189 _hlCursor.movePosition(QTextCursor::WordRight, QTextCursor::KeepAnchor); 190 _tb->setTextCursor(_hlCursor); 191 } 192 else { 193 _hlCursor.movePosition(QTextCursor::End); 194 _tb->setTextCursor(_hlCursor); 195 } 196 197 } 198 199 200 201 202
Note:
See TracChangeset
for help on using the changeset viewer.