25 @param parent reference to the parent widget (QWidget) |
27 @param parent reference to the parent widget (QWidget) |
26 @keyparam inactiveText text to be shown on inactivity (string) |
28 @keyparam inactiveText text to be shown on inactivity (string) |
27 @keyparam side side the clear button should be shown at (E5LineEdit.RightSide, |
29 @keyparam side side the clear button should be shown at (E5LineEdit.RightSide, |
28 E5LineEdit.LeftSide) |
30 E5LineEdit.LeftSide) |
29 """ |
31 """ |
30 super().__init__(parent, inactiveText, side) |
32 super(IrcMessageEdit, self).__init__(parent, inactiveText, side) |
31 |
33 |
32 self.__historyList = [""] # initialize with one empty line |
34 self.__historyList = [""] # initialize with one empty line |
33 self.__historyLine = 0 |
35 self.__historyLine = 0 |
34 |
36 |
35 def setText(self, text): |
37 def setText(self, text): |
38 |
40 |
39 Note: This reimplementation ensures, that the cursor is at the end of the text. |
41 Note: This reimplementation ensures, that the cursor is at the end of the text. |
40 |
42 |
41 @param text text to be set (string) |
43 @param text text to be set (string) |
42 """ |
44 """ |
43 super().setText(text) |
45 super(IrcMessageEdit, self).setText(text) |
44 self.setCursorPosition(len(text)) |
46 self.setCursorPosition(len(text)) |
45 |
47 |
46 def keyPressEvent(self, evt): |
48 def keyPressEvent(self, evt): |
47 """ |
49 """ |
48 Protected method implementing special key handling. |
50 Protected method implementing special key handling. |
61 self.__addHistory(self.text()) |
63 self.__addHistory(self.text()) |
62 elif evt.text() == chr(21): |
64 elif evt.text() == chr(21): |
63 # ^U: clear the text |
65 # ^U: clear the text |
64 self.setText("") |
66 self.setText("") |
65 |
67 |
66 super().keyPressEvent(evt) |
68 super(IrcMessageEdit, self).keyPressEvent(evt) |
67 |
69 |
68 def wheelEvent(self, evt): |
70 def wheelEvent(self, evt): |
69 """ |
71 """ |
70 Protected slot to support wheel events. |
72 Protected slot to support wheel events. |
71 |
73 |
74 if evt.delta() > 0: |
76 if evt.delta() > 0: |
75 self.__getHistory(True) |
77 self.__getHistory(True) |
76 elif evt.delta() < 0: |
78 elif evt.delta() < 0: |
77 self.__getHistory(False) |
79 self.__getHistory(False) |
78 |
80 |
79 super().wheelEvent(evt) |
81 super(IrcMessageEdit, self).wheelEvent(evt) |
80 |
82 |
81 def __addHistory(self, txt): |
83 def __addHistory(self, txt): |
82 """ |
84 """ |
83 Private method to add an entry to the history. |
85 Private method to add an entry to the history. |
84 |
86 |