E5Gui/E5LineEdit.py

branch
Py2 comp.
changeset 2525
8b507a9a2d40
parent 2401
4f428de32b69
child 3057
10516539f238
equal deleted inserted replaced
2523:139f182b72f6 2525:8b507a9a2d40
5 5
6 """ 6 """
7 Module implementing specialized line edits. 7 Module implementing specialized line edits.
8 """ 8 """
9 9
10 from __future__ import unicode_literals # __IGNORE_WARNING__
11
10 from PyQt4.QtCore import pyqtSignal, Qt, QEvent, qVersion 12 from PyQt4.QtCore import pyqtSignal, Qt, QEvent, qVersion
11 from PyQt4.QtGui import QLineEdit, QStyle, QPainter, QPalette, QStyleOptionFrameV2, \ 13 from PyQt4.QtGui import QLineEdit, QStyle, QPainter, QPalette, QStyleOptionFrameV2, \
12 QWidget, QHBoxLayout, QBoxLayout, QLayout, QApplication, QSpacerItem, QSizePolicy 14 QWidget, QHBoxLayout, QBoxLayout, QLayout, QApplication, QSpacerItem, QSizePolicy
13 15
14 import UI.PixmapCache 16 import UI.PixmapCache
24 """ 26 """
25 Constructor 27 Constructor
26 28
27 @param parent reference to the parent widget (QWidget) 29 @param parent reference to the parent widget (QWidget)
28 """ 30 """
29 super().__init__(parent) 31 super(E5LineEditSideWidget, self).__init__(parent)
30 32
31 def event(self, evt): 33 def event(self, evt):
32 """ 34 """
33 Protected method to handle events. 35 Protected method to handle events.
34 36
52 Constructor 54 Constructor
53 55
54 @param parent reference to the parent widget (QWidget) 56 @param parent reference to the parent widget (QWidget)
55 @param inactiveText text to be shown on inactivity (string) 57 @param inactiveText text to be shown on inactivity (string)
56 """ 58 """
57 super().__init__(parent) 59 super(E5LineEdit, self).__init__(parent)
58 60
59 self.setMinimumHeight(22) 61 self.setMinimumHeight(22)
60 62
61 if qVersion() < "4.7.0": 63 if qVersion() < "4.7.0":
62 self.__inactiveText = inactiveText 64 self.__inactiveText = inactiveText
140 """ 142 """
141 Protected method handling a paint event. 143 Protected method handling a paint event.
142 144
143 @param evt reference to the paint event (QPaintEvent) 145 @param evt reference to the paint event (QPaintEvent)
144 """ 146 """
145 super().paintEvent(evt) 147 super(E5LineEdit, self).paintEvent(evt)
146 148
147 if qVersion() < "4.7.0": 149 if qVersion() < "4.7.0":
148 if not self.text() and \ 150 if not self.text() and \
149 self.__inactiveText and \ 151 self.__inactiveText and \
150 not self.hasFocus(): 152 not self.hasFocus():
280 @keyparam side side the clear button should be shown at (E5LineEdit.RightSide, 282 @keyparam side side the clear button should be shown at (E5LineEdit.RightSide,
281 E5LineEdit.LeftSide) 283 E5LineEdit.LeftSide)
282 """ 284 """
283 assert side in [E5LineEdit.RightSide, E5LineEdit.LeftSide] 285 assert side in [E5LineEdit.RightSide, E5LineEdit.LeftSide]
284 286
285 super().__init__(parent, inactiveText) 287 super(E5ClearableLineEdit, self).__init__(parent, inactiveText)
286 288
287 from E5Gui.E5LineEditButton import E5LineEditButton 289 from E5Gui.E5LineEditButton import E5LineEditButton
288 self.__clearButton = E5LineEditButton(self) 290 self.__clearButton = E5LineEditButton(self)
289 self.__clearButton.setIcon(UI.PixmapCache.getIcon("clearLeft.png")) 291 self.__clearButton.setIcon(UI.PixmapCache.getIcon("clearLeft.png"))
290 self.addWidget(self.__clearButton, side) 292 self.addWidget(self.__clearButton, side)

eric ide

mercurial