12 from PyQt6.QtCore import pyqtSignal, Qt, QEvent |
12 from PyQt6.QtCore import pyqtSignal, Qt, QEvent |
13 from PyQt6.QtWidgets import ( |
13 from PyQt6.QtWidgets import ( |
14 QLineEdit, QWidget, QHBoxLayout, QBoxLayout, QLayout, QApplication, |
14 QLineEdit, QWidget, QHBoxLayout, QBoxLayout, QLayout, QApplication, |
15 QSpacerItem, QSizePolicy |
15 QSpacerItem, QSizePolicy |
16 ) |
16 ) |
17 |
|
18 import UI.PixmapCache |
|
19 |
17 |
20 |
18 |
21 class E5LineEditSideWidget(QWidget): |
19 class E5LineEditSideWidget(QWidget): |
22 """ |
20 """ |
23 Class implementing the side widgets for the line edit class. |
21 Class implementing the side widgets for the line edit class. |
276 @param side side the clear button should be shown at |
274 @param side side the clear button should be shown at |
277 @type E5LineEditSide |
275 @type E5LineEditSide |
278 """ |
276 """ |
279 super().__init__(parent, inactiveText) |
277 super().__init__(parent, inactiveText) |
280 |
278 |
281 from E5Gui.E5LineEditButton import E5LineEditButton |
279 self.setClearButtonEnabled(True) |
282 self.__clearButton = E5LineEditButton(self) |
|
283 self.__clearButton.setIcon(UI.PixmapCache.getIcon("clearLeft")) |
|
284 self.addWidget(self.__clearButton, side) |
|
285 self.__clearButton.setVisible(False) |
|
286 |
|
287 self.__clearButton.clicked.connect(self.clear) |
|
288 self.textChanged.connect(self.__textChanged) |
|
289 |
|
290 def __textChanged(self, txt): |
|
291 """ |
|
292 Private slot to handle changes of the text. |
|
293 |
|
294 @param txt text (string) |
|
295 """ |
|
296 self.__clearButton.setVisible(txt != "") |
|