|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.PdfViewer.PdfSearchWidget</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.PdfViewer.PdfSearchWidget</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a Search widget. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#PdfSearchResultsWidget">PdfSearchResultsWidget</a></td> |
|
25 <td>Class implementing a widget to show the search results.</td> |
|
26 </tr> |
|
27 <tr> |
|
28 <td><a href="#PdfSearchWidget">PdfSearchWidget</a></td> |
|
29 <td>Class implementing a Search widget.</td> |
|
30 </tr> |
|
31 </table> |
|
32 <h3>Functions</h3> |
|
33 |
|
34 <table> |
|
35 <tr><td>None</td></tr> |
|
36 </table> |
|
37 <hr /> |
|
38 <hr /> |
|
39 <a NAME="PdfSearchResultsWidget" ID="PdfSearchResultsWidget"></a> |
|
40 <h2>PdfSearchResultsWidget</h2> |
|
41 |
|
42 <p> |
|
43 Class implementing a widget to show the search results. |
|
44 </p> |
|
45 <h3>Signals</h3> |
|
46 <dl> |
|
47 |
|
48 <dt>rowCountChanged()</dt> |
|
49 <dd> |
|
50 emitted to indicate a change of the number |
|
51 of items |
|
52 </dd> |
|
53 <dt>searchCleared()</dt> |
|
54 <dd> |
|
55 emitted to indicate that the search results have been |
|
56 cleared |
|
57 </dd> |
|
58 <dt>searchNextAvailable(bool)</dt> |
|
59 <dd> |
|
60 emitted to indicate the availability of |
|
61 search results after the current one |
|
62 </dd> |
|
63 <dt>searchPrevAvailable(bool)</dt> |
|
64 <dd> |
|
65 emitted to indicate the availability of |
|
66 search results before the current one |
|
67 </dd> |
|
68 <dt>searchResult(QPdfLink)</dt> |
|
69 <dd> |
|
70 emitted to send the link of a search result |
|
71 </dd> |
|
72 </dl> |
|
73 <h3>Derived from</h3> |
|
74 QTreeWidget |
|
75 <h3>Class Attributes</h3> |
|
76 |
|
77 <table> |
|
78 <tr><td>None</td></tr> |
|
79 </table> |
|
80 <h3>Class Methods</h3> |
|
81 |
|
82 <table> |
|
83 <tr><td>None</td></tr> |
|
84 </table> |
|
85 <h3>Methods</h3> |
|
86 |
|
87 <table> |
|
88 |
|
89 <tr> |
|
90 <td><a href="#PdfSearchResultsWidget.__init__">PdfSearchResultsWidget</a></td> |
|
91 <td>Constructor</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#PdfSearchResultsWidget.__clear">__clear</a></td> |
|
95 <td>Private slot to clear the list of search results.</td> |
|
96 </tr> |
|
97 <tr> |
|
98 <td><a href="#PdfSearchResultsWidget.__handleCurrentItemChanged">__handleCurrentItemChanged</a></td> |
|
99 <td>Private slot to handle a change of the current item.</td> |
|
100 </tr> |
|
101 <tr> |
|
102 <td><a href="#PdfSearchResultsWidget.__rowsInserted">__rowsInserted</a></td> |
|
103 <td>Private slot to handle the insertion of rows of the search model.</td> |
|
104 </tr> |
|
105 <tr> |
|
106 <td><a href="#PdfSearchResultsWidget.currentRow">currentRow</a></td> |
|
107 <td>Public method to get the current row.</td> |
|
108 </tr> |
|
109 <tr> |
|
110 <td><a href="#PdfSearchResultsWidget.document">document</a></td> |
|
111 <td>Public method to get the reference to the PDF document object.</td> |
|
112 </tr> |
|
113 <tr> |
|
114 <td><a href="#PdfSearchResultsWidget.getPdfLink">getPdfLink</a></td> |
|
115 <td>Public method to get the PDF link associated with a search result item.</td> |
|
116 </tr> |
|
117 <tr> |
|
118 <td><a href="#PdfSearchResultsWidget.rowCount">rowCount</a></td> |
|
119 <td>Public method to get the number of rows.</td> |
|
120 </tr> |
|
121 <tr> |
|
122 <td><a href="#PdfSearchResultsWidget.searchResultData">searchResultData</a></td> |
|
123 <td>Public method to get data of a search result item.</td> |
|
124 </tr> |
|
125 <tr> |
|
126 <td><a href="#PdfSearchResultsWidget.searchString">searchString</a></td> |
|
127 <td>Public method to get the current search string.</td> |
|
128 </tr> |
|
129 <tr> |
|
130 <td><a href="#PdfSearchResultsWidget.setCurrentRow">setCurrentRow</a></td> |
|
131 <td>Public method to set the current row.</td> |
|
132 </tr> |
|
133 <tr> |
|
134 <td><a href="#PdfSearchResultsWidget.setDocument">setDocument</a></td> |
|
135 <td>Public method to set the PDF document object to be searched.</td> |
|
136 </tr> |
|
137 <tr> |
|
138 <td><a href="#PdfSearchResultsWidget.setSearchString">setSearchString</a></td> |
|
139 <td>Public method to set the search string.</td> |
|
140 </tr> |
|
141 </table> |
|
142 <h3>Static Methods</h3> |
|
143 |
|
144 <table> |
|
145 <tr><td>None</td></tr> |
|
146 </table> |
|
147 |
|
148 <a NAME="PdfSearchResultsWidget.__init__" ID="PdfSearchResultsWidget.__init__"></a> |
|
149 <h4>PdfSearchResultsWidget (Constructor)</h4> |
|
150 <b>PdfSearchResultsWidget</b>(<i>parent=None</i>) |
|
151 |
|
152 <p> |
|
153 Constructor |
|
154 </p> |
|
155 <dl> |
|
156 |
|
157 <dt><i>parent</i> (QWidget (optional))</dt> |
|
158 <dd> |
|
159 reference to the parent widget (defaults to None) |
|
160 </dd> |
|
161 </dl> |
|
162 <a NAME="PdfSearchResultsWidget.__clear" ID="PdfSearchResultsWidget.__clear"></a> |
|
163 <h4>PdfSearchResultsWidget.__clear</h4> |
|
164 <b>__clear</b>(<i></i>) |
|
165 |
|
166 <p> |
|
167 Private slot to clear the list of search results. |
|
168 </p> |
|
169 <a NAME="PdfSearchResultsWidget.__handleCurrentItemChanged" ID="PdfSearchResultsWidget.__handleCurrentItemChanged"></a> |
|
170 <h4>PdfSearchResultsWidget.__handleCurrentItemChanged</h4> |
|
171 <b>__handleCurrentItemChanged</b>(<i></i>) |
|
172 |
|
173 <p> |
|
174 Private slot to handle a change of the current item. |
|
175 </p> |
|
176 <a NAME="PdfSearchResultsWidget.__rowsInserted" ID="PdfSearchResultsWidget.__rowsInserted"></a> |
|
177 <h4>PdfSearchResultsWidget.__rowsInserted</h4> |
|
178 <b>__rowsInserted</b>(<i>parent, first, last</i>) |
|
179 |
|
180 <p> |
|
181 Private slot to handle the insertion of rows of the search model. |
|
182 </p> |
|
183 <dl> |
|
184 |
|
185 <dt><i>parent</i> (QModelIndex)</dt> |
|
186 <dd> |
|
187 reference to the parent index |
|
188 </dd> |
|
189 <dt><i>first</i> (int)</dt> |
|
190 <dd> |
|
191 first row inserted |
|
192 </dd> |
|
193 <dt><i>last</i> (int)</dt> |
|
194 <dd> |
|
195 last row inserted |
|
196 </dd> |
|
197 </dl> |
|
198 <a NAME="PdfSearchResultsWidget.currentRow" ID="PdfSearchResultsWidget.currentRow"></a> |
|
199 <h4>PdfSearchResultsWidget.currentRow</h4> |
|
200 <b>currentRow</b>(<i></i>) |
|
201 |
|
202 <p> |
|
203 Public method to get the current row. |
|
204 </p> |
|
205 <dl> |
|
206 <dt>Return:</dt> |
|
207 <dd> |
|
208 current row |
|
209 </dd> |
|
210 </dl> |
|
211 <dl> |
|
212 <dt>Return Type:</dt> |
|
213 <dd> |
|
214 int |
|
215 </dd> |
|
216 </dl> |
|
217 <a NAME="PdfSearchResultsWidget.document" ID="PdfSearchResultsWidget.document"></a> |
|
218 <h4>PdfSearchResultsWidget.document</h4> |
|
219 <b>document</b>(<i></i>) |
|
220 |
|
221 <p> |
|
222 Public method to get the reference to the PDF document object. |
|
223 </p> |
|
224 <dl> |
|
225 <dt>Return:</dt> |
|
226 <dd> |
|
227 reference to the PDF document object |
|
228 </dd> |
|
229 </dl> |
|
230 <dl> |
|
231 <dt>Return Type:</dt> |
|
232 <dd> |
|
233 QPdfDocument |
|
234 </dd> |
|
235 </dl> |
|
236 <a NAME="PdfSearchResultsWidget.getPdfLink" ID="PdfSearchResultsWidget.getPdfLink"></a> |
|
237 <h4>PdfSearchResultsWidget.getPdfLink</h4> |
|
238 <b>getPdfLink</b>(<i>item</i>) |
|
239 |
|
240 <p> |
|
241 Public method to get the PDF link associated with a search result item. |
|
242 </p> |
|
243 <dl> |
|
244 |
|
245 <dt><i>item</i> (QTreeWidgetItem)</dt> |
|
246 <dd> |
|
247 reference to the search result item |
|
248 </dd> |
|
249 </dl> |
|
250 <dl> |
|
251 <dt>Return:</dt> |
|
252 <dd> |
|
253 associated PDF link |
|
254 </dd> |
|
255 </dl> |
|
256 <dl> |
|
257 <dt>Return Type:</dt> |
|
258 <dd> |
|
259 QPdfLink |
|
260 </dd> |
|
261 </dl> |
|
262 <a NAME="PdfSearchResultsWidget.rowCount" ID="PdfSearchResultsWidget.rowCount"></a> |
|
263 <h4>PdfSearchResultsWidget.rowCount</h4> |
|
264 <b>rowCount</b>(<i></i>) |
|
265 |
|
266 <p> |
|
267 Public method to get the number of rows. |
|
268 </p> |
|
269 <dl> |
|
270 <dt>Return:</dt> |
|
271 <dd> |
|
272 number of rows |
|
273 </dd> |
|
274 </dl> |
|
275 <dl> |
|
276 <dt>Return Type:</dt> |
|
277 <dd> |
|
278 int |
|
279 </dd> |
|
280 </dl> |
|
281 <a NAME="PdfSearchResultsWidget.searchResultData" ID="PdfSearchResultsWidget.searchResultData"></a> |
|
282 <h4>PdfSearchResultsWidget.searchResultData</h4> |
|
283 <b>searchResultData</b>(<i>item, role</i>) |
|
284 |
|
285 <p> |
|
286 Public method to get data of a search result item. |
|
287 </p> |
|
288 <dl> |
|
289 |
|
290 <dt><i>item</i> (QTreeWidgetItem)</dt> |
|
291 <dd> |
|
292 reference to the search result item |
|
293 </dd> |
|
294 <dt><i>role</i> (QPdfSearchModel.Role or Qt.ItemDataRole)</dt> |
|
295 <dd> |
|
296 item data role |
|
297 </dd> |
|
298 </dl> |
|
299 <dl> |
|
300 <dt>Return:</dt> |
|
301 <dd> |
|
302 requested data |
|
303 </dd> |
|
304 </dl> |
|
305 <dl> |
|
306 <dt>Return Type:</dt> |
|
307 <dd> |
|
308 Any |
|
309 </dd> |
|
310 </dl> |
|
311 <a NAME="PdfSearchResultsWidget.searchString" ID="PdfSearchResultsWidget.searchString"></a> |
|
312 <h4>PdfSearchResultsWidget.searchString</h4> |
|
313 <b>searchString</b>(<i></i>) |
|
314 |
|
315 <p> |
|
316 Public method to get the current search string. |
|
317 </p> |
|
318 <dl> |
|
319 <dt>Return:</dt> |
|
320 <dd> |
|
321 search string |
|
322 </dd> |
|
323 </dl> |
|
324 <dl> |
|
325 <dt>Return Type:</dt> |
|
326 <dd> |
|
327 str |
|
328 </dd> |
|
329 </dl> |
|
330 <a NAME="PdfSearchResultsWidget.setCurrentRow" ID="PdfSearchResultsWidget.setCurrentRow"></a> |
|
331 <h4>PdfSearchResultsWidget.setCurrentRow</h4> |
|
332 <b>setCurrentRow</b>(<i>row</i>) |
|
333 |
|
334 <p> |
|
335 Public method to set the current row. |
|
336 </p> |
|
337 <dl> |
|
338 |
|
339 <dt><i>row</i> (int)</dt> |
|
340 <dd> |
|
341 row number to make the current row |
|
342 </dd> |
|
343 </dl> |
|
344 <a NAME="PdfSearchResultsWidget.setDocument" ID="PdfSearchResultsWidget.setDocument"></a> |
|
345 <h4>PdfSearchResultsWidget.setDocument</h4> |
|
346 <b>setDocument</b>(<i>document</i>) |
|
347 |
|
348 <p> |
|
349 Public method to set the PDF document object to be searched. |
|
350 </p> |
|
351 <dl> |
|
352 |
|
353 <dt><i>document</i> (QPdfDocument)</dt> |
|
354 <dd> |
|
355 reference to the PDF document object |
|
356 </dd> |
|
357 </dl> |
|
358 <a NAME="PdfSearchResultsWidget.setSearchString" ID="PdfSearchResultsWidget.setSearchString"></a> |
|
359 <h4>PdfSearchResultsWidget.setSearchString</h4> |
|
360 <b>setSearchString</b>(<i>searchString</i>) |
|
361 |
|
362 <p> |
|
363 Public method to set the search string. |
|
364 </p> |
|
365 <dl> |
|
366 |
|
367 <dt><i>searchString</i> (str)</dt> |
|
368 <dd> |
|
369 search string |
|
370 </dd> |
|
371 </dl> |
|
372 <div align="right"><a href="#top">Up</a></div> |
|
373 <hr /> |
|
374 <hr /> |
|
375 <a NAME="PdfSearchWidget" ID="PdfSearchWidget"></a> |
|
376 <h2>PdfSearchWidget</h2> |
|
377 |
|
378 <p> |
|
379 Class implementing a Search widget. |
|
380 </p> |
|
381 <h3>Signals</h3> |
|
382 <dl> |
|
383 |
|
384 <dt>searchCleared()</dt> |
|
385 <dd> |
|
386 emitted to indicate that the search results have been |
|
387 cleared |
|
388 </dd> |
|
389 <dt>searchNextAvailable(bool)</dt> |
|
390 <dd> |
|
391 emitted to indicate the availability of |
|
392 search results after the current one |
|
393 </dd> |
|
394 <dt>searchPrevAvailable(bool)</dt> |
|
395 <dd> |
|
396 emitted to indicate the availability of |
|
397 search results before the current one |
|
398 </dd> |
|
399 <dt>searchResult(QPdfLink)</dt> |
|
400 <dd> |
|
401 emitted to send the link of a search result |
|
402 </dd> |
|
403 <dt>searchResultActivated(QPdfLink)</dt> |
|
404 <dd> |
|
405 emitted to send the activated search |
|
406 result link |
|
407 </dd> |
|
408 </dl> |
|
409 <h3>Derived from</h3> |
|
410 QWidget |
|
411 <h3>Class Attributes</h3> |
|
412 |
|
413 <table> |
|
414 <tr><td>None</td></tr> |
|
415 </table> |
|
416 <h3>Class Methods</h3> |
|
417 |
|
418 <table> |
|
419 <tr><td>None</td></tr> |
|
420 </table> |
|
421 <h3>Methods</h3> |
|
422 |
|
423 <table> |
|
424 |
|
425 <tr> |
|
426 <td><a href="#PdfSearchWidget.__init__">PdfSearchWidget</a></td> |
|
427 <td>Constructor</td> |
|
428 </tr> |
|
429 <tr> |
|
430 <td><a href="#PdfSearchWidget.__entrySelected">__entrySelected</a></td> |
|
431 <td>Private slot to handle the selection of a search result entry.</td> |
|
432 </tr> |
|
433 <tr> |
|
434 <td><a href="#PdfSearchWidget.__handleDocumentStatus">__handleDocumentStatus</a></td> |
|
435 <td>Private slot to handle a change of the document status.</td> |
|
436 </tr> |
|
437 <tr> |
|
438 <td><a href="#PdfSearchWidget.__search">__search</a></td> |
|
439 <td>Private slot to initiate a new search.</td> |
|
440 </tr> |
|
441 <tr> |
|
442 <td><a href="#PdfSearchWidget.__searchTextChanged">__searchTextChanged</a></td> |
|
443 <td>Private slot to handle a change of the search string.</td> |
|
444 </tr> |
|
445 <tr> |
|
446 <td><a href="#PdfSearchWidget.__updateInfoLabel">__updateInfoLabel</a></td> |
|
447 <td>Private slot to update the data of the info label.</td> |
|
448 </tr> |
|
449 <tr> |
|
450 <td><a href="#PdfSearchWidget.activateSearch">activateSearch</a></td> |
|
451 <td>Public slot to 'activate' a search.</td> |
|
452 </tr> |
|
453 <tr> |
|
454 <td><a href="#PdfSearchWidget.nextResult">nextResult</a></td> |
|
455 <td>Public slot to activate the next result.</td> |
|
456 </tr> |
|
457 <tr> |
|
458 <td><a href="#PdfSearchWidget.previousResult">previousResult</a></td> |
|
459 <td>Public slot to activate the previous result.</td> |
|
460 </tr> |
|
461 </table> |
|
462 <h3>Static Methods</h3> |
|
463 |
|
464 <table> |
|
465 <tr><td>None</td></tr> |
|
466 </table> |
|
467 |
|
468 <a NAME="PdfSearchWidget.__init__" ID="PdfSearchWidget.__init__"></a> |
|
469 <h4>PdfSearchWidget (Constructor)</h4> |
|
470 <b>PdfSearchWidget</b>(<i>document, parent=None</i>) |
|
471 |
|
472 <p> |
|
473 Constructor |
|
474 </p> |
|
475 <dl> |
|
476 |
|
477 <dt><i>document</i> (QPdfDocument)</dt> |
|
478 <dd> |
|
479 reference to the PDF document object |
|
480 </dd> |
|
481 <dt><i>parent</i> (QWidget (optional))</dt> |
|
482 <dd> |
|
483 reference to the parent widget (defaults to None) |
|
484 </dd> |
|
485 </dl> |
|
486 <a NAME="PdfSearchWidget.__entrySelected" ID="PdfSearchWidget.__entrySelected"></a> |
|
487 <h4>PdfSearchWidget.__entrySelected</h4> |
|
488 <b>__entrySelected</b>(<i>item</i>) |
|
489 |
|
490 <p> |
|
491 Private slot to handle the selection of a search result entry. |
|
492 </p> |
|
493 <dl> |
|
494 |
|
495 <dt><i>item</i> (QTreeWidgetItem)</dt> |
|
496 <dd> |
|
497 reference to the selected item |
|
498 </dd> |
|
499 </dl> |
|
500 <a NAME="PdfSearchWidget.__handleDocumentStatus" ID="PdfSearchWidget.__handleDocumentStatus"></a> |
|
501 <h4>PdfSearchWidget.__handleDocumentStatus</h4> |
|
502 <b>__handleDocumentStatus</b>(<i>status</i>) |
|
503 |
|
504 <p> |
|
505 Private slot to handle a change of the document status. |
|
506 </p> |
|
507 <dl> |
|
508 |
|
509 <dt><i>status</i> (QPdfDocument.Status)</dt> |
|
510 <dd> |
|
511 document status |
|
512 </dd> |
|
513 </dl> |
|
514 <a NAME="PdfSearchWidget.__search" ID="PdfSearchWidget.__search"></a> |
|
515 <h4>PdfSearchWidget.__search</h4> |
|
516 <b>__search</b>(<i></i>) |
|
517 |
|
518 <p> |
|
519 Private slot to initiate a new search. |
|
520 </p> |
|
521 <a NAME="PdfSearchWidget.__searchTextChanged" ID="PdfSearchWidget.__searchTextChanged"></a> |
|
522 <h4>PdfSearchWidget.__searchTextChanged</h4> |
|
523 <b>__searchTextChanged</b>(<i>text</i>) |
|
524 |
|
525 <p> |
|
526 Private slot to handle a change of the search string. |
|
527 </p> |
|
528 <dl> |
|
529 |
|
530 <dt><i>text</i> (str)</dt> |
|
531 <dd> |
|
532 search string |
|
533 </dd> |
|
534 </dl> |
|
535 <a NAME="PdfSearchWidget.__updateInfoLabel" ID="PdfSearchWidget.__updateInfoLabel"></a> |
|
536 <h4>PdfSearchWidget.__updateInfoLabel</h4> |
|
537 <b>__updateInfoLabel</b>(<i></i>) |
|
538 |
|
539 <p> |
|
540 Private slot to update the data of the info label. |
|
541 </p> |
|
542 <a NAME="PdfSearchWidget.activateSearch" ID="PdfSearchWidget.activateSearch"></a> |
|
543 <h4>PdfSearchWidget.activateSearch</h4> |
|
544 <b>activateSearch</b>(<i></i>) |
|
545 |
|
546 <p> |
|
547 Public slot to 'activate' a search. |
|
548 </p> |
|
549 <a NAME="PdfSearchWidget.nextResult" ID="PdfSearchWidget.nextResult"></a> |
|
550 <h4>PdfSearchWidget.nextResult</h4> |
|
551 <b>nextResult</b>(<i></i>) |
|
552 |
|
553 <p> |
|
554 Public slot to activate the next result. |
|
555 </p> |
|
556 <a NAME="PdfSearchWidget.previousResult" ID="PdfSearchWidget.previousResult"></a> |
|
557 <h4>PdfSearchWidget.previousResult</h4> |
|
558 <b>previousResult</b>(<i></i>) |
|
559 |
|
560 <p> |
|
561 Public slot to activate the previous result. |
|
562 </p> |
|
563 <div align="right"><a href="#top">Up</a></div> |
|
564 <hr /> |
|
565 </body></html> |