136 self.replacetextCombo.lineEdit().returnPressed.connect( |
136 self.replacetextCombo.lineEdit().returnPressed.connect( |
137 self.on_replaceButton_clicked |
137 self.on_replaceButton_clicked |
138 ) |
138 ) |
139 |
139 |
140 self.__currentEditor = None |
140 self.__currentEditor = None |
|
141 self.__replaceMode = False |
141 |
142 |
142 self.findtextCombo.lineEdit().textEdited.connect(self.__quickSearch) |
143 self.findtextCombo.lineEdit().textEdited.connect(self.__quickSearch) |
143 self.caseCheckBox.toggled.connect(self.__updateQuickSearchMarkers) |
144 self.caseCheckBox.toggled.connect(self.__updateQuickSearchMarkers) |
144 self.wordCheckBox.toggled.connect(self.__updateQuickSearchMarkers) |
145 self.wordCheckBox.toggled.connect(self.__updateQuickSearchMarkers) |
145 self.regexpCheckBox.toggled.connect(self.__updateQuickSearchMarkers) |
146 self.regexpCheckBox.toggled.connect(self.__updateQuickSearchMarkers) |
|
147 |
|
148 self.replacetextCombo.installEventFilter(self) |
146 |
149 |
147 self.__findtextComboStyleSheet = self.findtextCombo.styleSheet() |
150 self.__findtextComboStyleSheet = self.findtextCombo.styleSheet() |
148 |
151 |
149 # define actions |
152 # define actions |
150 self.findNextAct = EricAction( |
153 self.findNextAct = EricAction( |
233 self.havefound = False |
236 self.havefound = False |
234 self.__pos = None |
237 self.__pos = None |
235 self.__findBackwards = False |
238 self.__findBackwards = False |
236 self.__selections = [] |
239 self.__selections = [] |
237 self.__finding = False |
240 self.__finding = False |
|
241 |
|
242 def eventFilter(self, obj, evt): |
|
243 """ |
|
244 Public method to handle events for other objects. |
|
245 |
|
246 @param obj reference to the object |
|
247 @type QObject |
|
248 @param evt reference to the event |
|
249 @type QEvent |
|
250 @return flag indicating that the event should be filtered out |
|
251 @rtype bool |
|
252 """ |
|
253 if ( |
|
254 obj is self.replacetextCombo |
|
255 and evt.type() == QEvent.Type.FocusIn |
|
256 and self.__replaceMode |
|
257 ): |
|
258 if not bool(self.replacetextCombo.currentText()): |
|
259 self.replacetextCombo.setCurrentText(self.findtextCombo.currentText()) |
|
260 self.replacetextCombo.lineEdit().selectAll() |
|
261 return True |
|
262 |
|
263 return super().eventFilter(obj, evt) |
|
264 |
|
265 def changeEvent(self, evt): |
|
266 """ |
|
267 Protected method handling state changes. |
|
268 |
|
269 @param evt event containing the state change |
|
270 @type QEvent |
|
271 """ |
|
272 if evt.type() == QEvent.Type.FontChange: |
|
273 self.adjustSize() |
238 |
274 |
239 def __setShortcuts(self): |
275 def __setShortcuts(self): |
240 """ |
276 """ |
241 Private method to set the local action's shortcuts to the same key |
277 Private method to set the local action's shortcuts to the same key |
242 sequences as in the view manager. |
278 sequences as in the view manager. |
343 @param enable flag indicating the enable state to be set |
379 @param enable flag indicating the enable state to be set |
344 @type bool |
380 @type bool |
345 """ |
381 """ |
346 self.replaceAllButton.setEnabled(enable) |
382 self.replaceAllButton.setEnabled(enable) |
347 self.replaceAllAct.setEnabled(enable) |
383 self.replaceAllAct.setEnabled(enable) |
348 |
|
349 def changeEvent(self, evt): |
|
350 """ |
|
351 Protected method handling state changes. |
|
352 |
|
353 @param evt event containing the state change |
|
354 @type QEvent |
|
355 """ |
|
356 if evt.type() == QEvent.Type.FontChange: |
|
357 self.adjustSize() |
|
358 |
384 |
359 def __selectionBoundary(self, selections=None): |
385 def __selectionBoundary(self, selections=None): |
360 """ |
386 """ |
361 Private method to calculate the current selection boundary. |
387 Private method to calculate the current selection boundary. |
362 |
388 |
1046 |
1072 |
1047 def __doReplace(self, searchNext): |
1073 def __doReplace(self, searchNext): |
1048 """ |
1074 """ |
1049 Private method to replace one occurrence of text. |
1075 Private method to replace one occurrence of text. |
1050 |
1076 |
1051 @param searchNext flag indicating to search for the next occurrence |
1077 @param searchNext flag indicating to search for the next occurrence. |
1052 (boolean). |
1078 @type bool |
1053 """ |
1079 """ |
1054 self.__finding = True |
1080 self.__finding = True |
1055 |
1081 |
1056 # Check enabled status due to dual purpose usage of this method |
1082 # Check enabled status due to dual purpose usage of this method |
1057 if ( |
1083 if ( |