|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.EricWidgets.EricTextEditSearchWidget</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body> |
|
22 <a NAME="top" ID="top"></a> |
|
23 <h1>eric7.EricWidgets.EricTextEditSearchWidget</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing a horizontal search widget for QTextEdit. |
|
27 </p> |
|
28 <h3>Global Attributes</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <h3>Classes</h3> |
|
34 |
|
35 <table> |
|
36 |
|
37 <tr> |
|
38 <td><a href="#EricTextEditSearchWidget">EricTextEditSearchWidget</a></td> |
|
39 <td>Class implementing a horizontal search widget for QTextEdit.</td> |
|
40 </tr> |
|
41 <tr> |
|
42 <td><a href="#EricTextEditType">EricTextEditType</a></td> |
|
43 <td>Class defining the supported text edit types.</td> |
|
44 </tr> |
|
45 </table> |
|
46 <h3>Functions</h3> |
|
47 |
|
48 <table> |
|
49 <tr><td>None</td></tr> |
|
50 </table> |
|
51 <hr /> |
|
52 <hr /> |
|
53 <a NAME="EricTextEditSearchWidget" ID="EricTextEditSearchWidget"></a> |
|
54 <h2>EricTextEditSearchWidget</h2> |
|
55 |
|
56 <p> |
|
57 Class implementing a horizontal search widget for QTextEdit. |
|
58 </p> |
|
59 <h3>Derived from</h3> |
|
60 QWidget |
|
61 <h3>Class Attributes</h3> |
|
62 |
|
63 <table> |
|
64 <tr><td>None</td></tr> |
|
65 </table> |
|
66 <h3>Class Methods</h3> |
|
67 |
|
68 <table> |
|
69 <tr><td>None</td></tr> |
|
70 </table> |
|
71 <h3>Methods</h3> |
|
72 |
|
73 <table> |
|
74 |
|
75 <tr> |
|
76 <td><a href="#EricTextEditSearchWidget.__init__">EricTextEditSearchWidget</a></td> |
|
77 <td>Constructor</td> |
|
78 </tr> |
|
79 <tr> |
|
80 <td><a href="#EricTextEditSearchWidget.__addWidthForHeightLayout">__addWidthForHeightLayout</a></td> |
|
81 <td>Private method to set the middle part of the layout.</td> |
|
82 </tr> |
|
83 <tr> |
|
84 <td><a href="#EricTextEditSearchWidget.__find">__find</a></td> |
|
85 <td>Private method to search the associated text edit.</td> |
|
86 </tr> |
|
87 <tr> |
|
88 <td><a href="#EricTextEditSearchWidget.__findByReturnPressed">__findByReturnPressed</a></td> |
|
89 <td>Private slot to handle the returnPressed signal of the findtext combobox.</td> |
|
90 </tr> |
|
91 <tr> |
|
92 <td><a href="#EricTextEditSearchWidget.__findNextPrevCallback">__findNextPrevCallback</a></td> |
|
93 <td>Private method to process the result of the last search.</td> |
|
94 </tr> |
|
95 <tr> |
|
96 <td><a href="#EricTextEditSearchWidget.__findPrevNextQTextEdit">__findPrevNextQTextEdit</a></td> |
|
97 <td>Private method to to search the associated edit widget of type QTextEdit.</td> |
|
98 </tr> |
|
99 <tr> |
|
100 <td><a href="#EricTextEditSearchWidget.__findPrevNextQWebEngineView">__findPrevNextQWebEngineView</a></td> |
|
101 <td>Private method to to search the associated edit widget of type QWebEngineView.</td> |
|
102 </tr> |
|
103 <tr> |
|
104 <td><a href="#EricTextEditSearchWidget.__setFindtextComboBackground">__setFindtextComboBackground</a></td> |
|
105 <td>Private slot to change the findtext combo background to indicate errors.</td> |
|
106 </tr> |
|
107 <tr> |
|
108 <td><a href="#EricTextEditSearchWidget.__setSearchButtons">__setSearchButtons</a></td> |
|
109 <td>Private slot to set the state of the search buttons.</td> |
|
110 </tr> |
|
111 <tr> |
|
112 <td><a href="#EricTextEditSearchWidget.__setupUi">__setupUi</a></td> |
|
113 <td>Private method to generate the UI.</td> |
|
114 </tr> |
|
115 <tr> |
|
116 <td><a href="#EricTextEditSearchWidget.attachTextEdit">attachTextEdit</a></td> |
|
117 <td>Public method to attach a QTextEdit widget.</td> |
|
118 </tr> |
|
119 <tr> |
|
120 <td><a href="#EricTextEditSearchWidget.keyPressEvent">keyPressEvent</a></td> |
|
121 <td>Protected slot to handle key press events.</td> |
|
122 </tr> |
|
123 <tr> |
|
124 <td><a href="#EricTextEditSearchWidget.on_findNextButton_clicked">on_findNextButton_clicked</a></td> |
|
125 <td>Private slot to find the next occurrence.</td> |
|
126 </tr> |
|
127 <tr> |
|
128 <td><a href="#EricTextEditSearchWidget.on_findPrevButton_clicked">on_findPrevButton_clicked</a></td> |
|
129 <td>Private slot to find the previous occurrence.</td> |
|
130 </tr> |
|
131 <tr> |
|
132 <td><a href="#EricTextEditSearchWidget.on_findtextCombo_editTextChanged">on_findtextCombo_editTextChanged</a></td> |
|
133 <td>Private slot to enable/disable the find buttons.</td> |
|
134 </tr> |
|
135 <tr> |
|
136 <td><a href="#EricTextEditSearchWidget.setWidthForHeight">setWidthForHeight</a></td> |
|
137 <td>Public method to set the 'width for height'.</td> |
|
138 </tr> |
|
139 </table> |
|
140 <h3>Static Methods</h3> |
|
141 |
|
142 <table> |
|
143 <tr><td>None</td></tr> |
|
144 </table> |
|
145 |
|
146 <a NAME="EricTextEditSearchWidget.__init__" ID="EricTextEditSearchWidget.__init__"></a> |
|
147 <h4>EricTextEditSearchWidget (Constructor)</h4> |
|
148 <b>EricTextEditSearchWidget</b>(<i>parent=None, widthForHeight=True</i>) |
|
149 |
|
150 <p> |
|
151 Constructor |
|
152 </p> |
|
153 <dl> |
|
154 |
|
155 <dt><i>parent</i> (QWidget)</dt> |
|
156 <dd> |
|
157 reference to the parent widget |
|
158 </dd> |
|
159 <dt><i>widthForHeight</i> (bool)</dt> |
|
160 <dd> |
|
161 flag indicating to prefer width for height. |
|
162 If this parameter is False, some widgets are shown in a third |
|
163 line. |
|
164 </dd> |
|
165 </dl> |
|
166 <a NAME="EricTextEditSearchWidget.__addWidthForHeightLayout" ID="EricTextEditSearchWidget.__addWidthForHeightLayout"></a> |
|
167 <h4>EricTextEditSearchWidget.__addWidthForHeightLayout</h4> |
|
168 <b>__addWidthForHeightLayout</b>(<i>widthForHeight</i>) |
|
169 |
|
170 <p> |
|
171 Private method to set the middle part of the layout. |
|
172 </p> |
|
173 <dl> |
|
174 |
|
175 <dt><i>widthForHeight</i> (bool)</dt> |
|
176 <dd> |
|
177 flag indicating to prefer width |
|
178 </dd> |
|
179 </dl> |
|
180 <a NAME="EricTextEditSearchWidget.__find" ID="EricTextEditSearchWidget.__find"></a> |
|
181 <h4>EricTextEditSearchWidget.__find</h4> |
|
182 <b>__find</b>(<i>backwards</i>) |
|
183 |
|
184 <p> |
|
185 Private method to search the associated text edit. |
|
186 </p> |
|
187 <dl> |
|
188 |
|
189 <dt><i>backwards</i></dt> |
|
190 <dd> |
|
191 flag indicating a backwards search (boolean) |
|
192 </dd> |
|
193 </dl> |
|
194 <a NAME="EricTextEditSearchWidget.__findByReturnPressed" ID="EricTextEditSearchWidget.__findByReturnPressed"></a> |
|
195 <h4>EricTextEditSearchWidget.__findByReturnPressed</h4> |
|
196 <b>__findByReturnPressed</b>(<i></i>) |
|
197 |
|
198 <p> |
|
199 Private slot to handle the returnPressed signal of the findtext |
|
200 combobox. |
|
201 </p> |
|
202 <a NAME="EricTextEditSearchWidget.__findNextPrevCallback" ID="EricTextEditSearchWidget.__findNextPrevCallback"></a> |
|
203 <h4>EricTextEditSearchWidget.__findNextPrevCallback</h4> |
|
204 <b>__findNextPrevCallback</b>(<i>found</i>) |
|
205 |
|
206 <p> |
|
207 Private method to process the result of the last search. |
|
208 </p> |
|
209 <dl> |
|
210 |
|
211 <dt><i>found</i> (bool)</dt> |
|
212 <dd> |
|
213 flag indicating if the last search succeeded |
|
214 </dd> |
|
215 </dl> |
|
216 <a NAME="EricTextEditSearchWidget.__findPrevNextQTextEdit" ID="EricTextEditSearchWidget.__findPrevNextQTextEdit"></a> |
|
217 <h4>EricTextEditSearchWidget.__findPrevNextQTextEdit</h4> |
|
218 <b>__findPrevNextQTextEdit</b>(<i>backwards</i>) |
|
219 |
|
220 <p> |
|
221 Private method to to search the associated edit widget of |
|
222 type QTextEdit. |
|
223 </p> |
|
224 <dl> |
|
225 |
|
226 <dt><i>backwards</i> (bool)</dt> |
|
227 <dd> |
|
228 flag indicating a backwards search |
|
229 </dd> |
|
230 </dl> |
|
231 <dl> |
|
232 <dt>Return:</dt> |
|
233 <dd> |
|
234 flag indicating the search result |
|
235 </dd> |
|
236 </dl> |
|
237 <dl> |
|
238 <dt>Return Type:</dt> |
|
239 <dd> |
|
240 bool |
|
241 </dd> |
|
242 </dl> |
|
243 <a NAME="EricTextEditSearchWidget.__findPrevNextQWebEngineView" ID="EricTextEditSearchWidget.__findPrevNextQWebEngineView"></a> |
|
244 <h4>EricTextEditSearchWidget.__findPrevNextQWebEngineView</h4> |
|
245 <b>__findPrevNextQWebEngineView</b>(<i>backwards</i>) |
|
246 |
|
247 <p> |
|
248 Private method to to search the associated edit widget of |
|
249 type QWebEngineView. |
|
250 </p> |
|
251 <dl> |
|
252 |
|
253 <dt><i>backwards</i> (bool)</dt> |
|
254 <dd> |
|
255 flag indicating a backwards search |
|
256 </dd> |
|
257 </dl> |
|
258 <a NAME="EricTextEditSearchWidget.__setFindtextComboBackground" ID="EricTextEditSearchWidget.__setFindtextComboBackground"></a> |
|
259 <h4>EricTextEditSearchWidget.__setFindtextComboBackground</h4> |
|
260 <b>__setFindtextComboBackground</b>(<i>error</i>) |
|
261 |
|
262 <p> |
|
263 Private slot to change the findtext combo background to indicate |
|
264 errors. |
|
265 </p> |
|
266 <dl> |
|
267 |
|
268 <dt><i>error</i></dt> |
|
269 <dd> |
|
270 flag indicating an error condition (boolean) |
|
271 </dd> |
|
272 </dl> |
|
273 <a NAME="EricTextEditSearchWidget.__setSearchButtons" ID="EricTextEditSearchWidget.__setSearchButtons"></a> |
|
274 <h4>EricTextEditSearchWidget.__setSearchButtons</h4> |
|
275 <b>__setSearchButtons</b>(<i>enabled</i>) |
|
276 |
|
277 <p> |
|
278 Private slot to set the state of the search buttons. |
|
279 </p> |
|
280 <dl> |
|
281 |
|
282 <dt><i>enabled</i></dt> |
|
283 <dd> |
|
284 flag indicating the state (boolean) |
|
285 </dd> |
|
286 </dl> |
|
287 <a NAME="EricTextEditSearchWidget.__setupUi" ID="EricTextEditSearchWidget.__setupUi"></a> |
|
288 <h4>EricTextEditSearchWidget.__setupUi</h4> |
|
289 <b>__setupUi</b>(<i>widthForHeight</i>) |
|
290 |
|
291 <p> |
|
292 Private method to generate the UI. |
|
293 </p> |
|
294 <dl> |
|
295 |
|
296 <dt><i>widthForHeight</i> (bool)</dt> |
|
297 <dd> |
|
298 flag indicating to prefer width for height |
|
299 </dd> |
|
300 </dl> |
|
301 <a NAME="EricTextEditSearchWidget.attachTextEdit" ID="EricTextEditSearchWidget.attachTextEdit"></a> |
|
302 <h4>EricTextEditSearchWidget.attachTextEdit</h4> |
|
303 <b>attachTextEdit</b>(<i>textedit, editType=EricTextEditType.QTEXTEDIT</i>) |
|
304 |
|
305 <p> |
|
306 Public method to attach a QTextEdit widget. |
|
307 </p> |
|
308 <dl> |
|
309 |
|
310 <dt><i>textedit</i> (QTextEdit, QWebEngineView or QWebView)</dt> |
|
311 <dd> |
|
312 reference to the edit widget to be attached |
|
313 </dd> |
|
314 <dt><i>editType</i> (EricTextEditType)</dt> |
|
315 <dd> |
|
316 type of the attached edit widget |
|
317 </dd> |
|
318 </dl> |
|
319 <a NAME="EricTextEditSearchWidget.keyPressEvent" ID="EricTextEditSearchWidget.keyPressEvent"></a> |
|
320 <h4>EricTextEditSearchWidget.keyPressEvent</h4> |
|
321 <b>keyPressEvent</b>(<i>event</i>) |
|
322 |
|
323 <p> |
|
324 Protected slot to handle key press events. |
|
325 </p> |
|
326 <dl> |
|
327 |
|
328 <dt><i>event</i></dt> |
|
329 <dd> |
|
330 reference to the key press event (QKeyEvent) |
|
331 </dd> |
|
332 </dl> |
|
333 <a NAME="EricTextEditSearchWidget.on_findNextButton_clicked" ID="EricTextEditSearchWidget.on_findNextButton_clicked"></a> |
|
334 <h4>EricTextEditSearchWidget.on_findNextButton_clicked</h4> |
|
335 <b>on_findNextButton_clicked</b>(<i></i>) |
|
336 |
|
337 <p> |
|
338 Private slot to find the next occurrence. |
|
339 </p> |
|
340 <a NAME="EricTextEditSearchWidget.on_findPrevButton_clicked" ID="EricTextEditSearchWidget.on_findPrevButton_clicked"></a> |
|
341 <h4>EricTextEditSearchWidget.on_findPrevButton_clicked</h4> |
|
342 <b>on_findPrevButton_clicked</b>(<i></i>) |
|
343 |
|
344 <p> |
|
345 Private slot to find the previous occurrence. |
|
346 </p> |
|
347 <a NAME="EricTextEditSearchWidget.on_findtextCombo_editTextChanged" ID="EricTextEditSearchWidget.on_findtextCombo_editTextChanged"></a> |
|
348 <h4>EricTextEditSearchWidget.on_findtextCombo_editTextChanged</h4> |
|
349 <b>on_findtextCombo_editTextChanged</b>(<i>txt</i>) |
|
350 |
|
351 <p> |
|
352 Private slot to enable/disable the find buttons. |
|
353 </p> |
|
354 <dl> |
|
355 |
|
356 <dt><i>txt</i></dt> |
|
357 <dd> |
|
358 text of the combobox (string) |
|
359 </dd> |
|
360 </dl> |
|
361 <a NAME="EricTextEditSearchWidget.setWidthForHeight" ID="EricTextEditSearchWidget.setWidthForHeight"></a> |
|
362 <h4>EricTextEditSearchWidget.setWidthForHeight</h4> |
|
363 <b>setWidthForHeight</b>(<i>widthForHeight</i>) |
|
364 |
|
365 <p> |
|
366 Public method to set the 'width for height'. |
|
367 </p> |
|
368 <dl> |
|
369 |
|
370 <dt><i>widthForHeight</i> (bool)</dt> |
|
371 <dd> |
|
372 flag indicating to prefer width |
|
373 </dd> |
|
374 </dl> |
|
375 <div align="right"><a href="#top">Up</a></div> |
|
376 <hr /> |
|
377 <hr /> |
|
378 <a NAME="EricTextEditType" ID="EricTextEditType"></a> |
|
379 <h2>EricTextEditType</h2> |
|
380 |
|
381 <p> |
|
382 Class defining the supported text edit types. |
|
383 </p> |
|
384 <h3>Derived from</h3> |
|
385 enum.Enum |
|
386 <h3>Class Attributes</h3> |
|
387 |
|
388 <table> |
|
389 <tr><td>QTEXTBROWSER</td></tr><tr><td>QTEXTEDIT</td></tr><tr><td>QWEBENGINEVIEW</td></tr><tr><td>UNKNOWN</td></tr> |
|
390 </table> |
|
391 <h3>Class Methods</h3> |
|
392 |
|
393 <table> |
|
394 <tr><td>None</td></tr> |
|
395 </table> |
|
396 <h3>Methods</h3> |
|
397 |
|
398 <table> |
|
399 <tr><td>None</td></tr> |
|
400 </table> |
|
401 <h3>Static Methods</h3> |
|
402 |
|
403 <table> |
|
404 <tr><td>None</td></tr> |
|
405 </table> |
|
406 |
|
407 <div align="right"><a href="#top">Up</a></div> |
|
408 <hr /> |
|
409 </body></html> |