20 |
20 |
21 def __init__(self, parent=None): |
21 def __init__(self, parent=None): |
22 """ |
22 """ |
23 Constructor |
23 Constructor |
24 |
24 |
25 @param parent reference to the parent widget (QWidget) |
25 @param parent reference to the parent widget |
|
26 @type QWidget |
26 """ |
27 """ |
27 super().__init__(parent) |
28 super().__init__(parent) |
28 self.setAcceptRichText(False) |
29 self.setAcceptRichText(False) |
29 self.setLineWrapMode(QTextEdit.LineWrapMode.NoWrap) |
30 self.setLineWrapMode(QTextEdit.LineWrapMode.NoWrap) |
30 self.setReadOnly(True) |
31 self.setReadOnly(True) |
53 |
54 |
54 def __handleShowContextMenu(self, coord): |
55 def __handleShowContextMenu(self, coord): |
55 """ |
56 """ |
56 Private slot to show the context menu. |
57 Private slot to show the context menu. |
57 |
58 |
58 @param coord the position of the mouse pointer (QPoint) |
59 @param coord the position of the mouse pointer |
|
60 @type QPoint |
59 """ |
61 """ |
60 coord = self.mapToGlobal(coord) |
62 coord = self.mapToGlobal(coord) |
61 self.__menu.popup(coord) |
63 self.__menu.popup(coord) |
62 |
64 |
63 def __appendText(self, txt): |
65 def __appendText(self, txt): |
64 """ |
66 """ |
65 Private method to append text to the end. |
67 Private method to append text to the end. |
66 |
68 |
67 @param txt text to insert (string) |
69 @param txt text to insert |
|
70 @type str |
68 """ |
71 """ |
69 tc = self.textCursor() |
72 tc = self.textCursor() |
70 tc.movePosition(QTextCursor.MoveOperation.End) |
73 tc.movePosition(QTextCursor.MoveOperation.End) |
71 self.setTextCursor(tc) |
74 self.setTextCursor(tc) |
72 self.insertPlainText(txt) |
75 self.insertPlainText(txt) |
74 |
77 |
75 def keyPressEvent(self, evt): |
78 def keyPressEvent(self, evt): |
76 """ |
79 """ |
77 Protected method handling key press events. |
80 Protected method handling key press events. |
78 |
81 |
79 @param evt key press event (QKeyEvent) |
82 @param evt key press event |
|
83 @type QKeyEvent |
80 """ |
84 """ |
81 if evt.modifiers() == Qt.KeyboardModifier.ControlModifier: |
85 if evt.modifiers() == Qt.KeyboardModifier.ControlModifier: |
82 if evt.key() == Qt.Key.Key_C: |
86 if evt.key() == Qt.Key.Key_C: |
83 self.copy() |
87 self.copy() |
84 evt.accept() |
88 evt.accept() |