2 |
2 |
3 # Copyright (c) 2009 - 2011 Detlev Offenbach <detlev@die-offenbachs.de> |
3 # Copyright (c) 2009 - 2011 Detlev Offenbach <detlev@die-offenbachs.de> |
4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing specialized line edits. |
7 Module implementing specialized line edits. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import pyqtSignal, Qt, QEvent |
10 from PyQt4.QtCore import pyqtSignal, Qt, QEvent |
11 from PyQt4.QtGui import QLineEdit, QStyleOptionFrameV2, QStyle, QPainter, QPalette, \ |
11 from PyQt4.QtGui import QLineEdit, QStyleOptionFrameV2, QStyle, QPainter, QPalette, \ |
12 QWidget, QHBoxLayout, QBoxLayout, QLayout, QApplication, QSpacerItem, QSizePolicy |
12 QWidget, QHBoxLayout, QBoxLayout, QLayout, QApplication, QSpacerItem, QSizePolicy |
13 |
13 |
|
14 |
14 class SideWidget(QWidget): |
15 class SideWidget(QWidget): |
15 """ |
16 """ |
16 Class implementing the side widgets for the line edit class. |
17 Class implementing the side widgets for the line edit class. |
17 """ |
18 """ |
18 sizeHintChanged = pyqtSignal() |
19 sizeHintChanged = pyqtSignal() |
19 |
20 |
20 def __init__(self, parent = None): |
21 def __init__(self, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param parent reference to the parent widget (QWidget) |
25 @param parent reference to the parent widget (QWidget) |
25 """ |
26 """ |
34 """ |
35 """ |
35 if evt.type() == QEvent.LayoutRequest: |
36 if evt.type() == QEvent.LayoutRequest: |
36 self.sizeHintChanged.emit() |
37 self.sizeHintChanged.emit() |
37 return QWidget.event(self, evt) |
38 return QWidget.event(self, evt) |
38 |
39 |
|
40 |
39 class E5LineEdit(QLineEdit): |
41 class E5LineEdit(QLineEdit): |
40 """ |
42 """ |
41 Class implementing a line edit widget showing some inactive text. |
43 Class implementing a line edit widget showing some inactive text. |
42 """ |
44 """ |
43 LeftSide = 0 |
45 LeftSide = 0 |
44 RightSide = 1 |
46 RightSide = 1 |
45 |
47 |
46 def __init__(self, parent = None, inactiveText = ""): |
48 def __init__(self, parent=None, inactiveText=""): |
47 """ |
49 """ |
48 Constructor |
50 Constructor |
49 |
51 |
50 @param parent reference to the parent widget (QWidget) |
52 @param parent reference to the parent widget (QWidget) |
51 @param inactiveText text to be shown on inactivity (string) |
53 @param inactiveText text to be shown on inactivity (string) |