25 |
25 |
26 def __init__(self, parent=None): |
26 def __init__(self, parent=None): |
27 """ |
27 """ |
28 Constructor |
28 Constructor |
29 |
29 |
30 @param parent reference to the parent widget (QWidget) |
30 @param parent reference to the parent widget |
|
31 @type QWidget |
31 """ |
32 """ |
32 super().__init__(parent) |
33 super().__init__(parent) |
33 |
34 |
34 self.__delegate = GreaseMonkeyConfigurationListDelegate(self) |
35 self.__delegate = GreaseMonkeyConfigurationListDelegate(self) |
35 self.setItemDelegate(self.__delegate) |
36 self.setItemDelegate(self.__delegate) |
37 def __containsRemoveIcon(self, pos): |
38 def __containsRemoveIcon(self, pos): |
38 """ |
39 """ |
39 Private method to check, if the given position is inside the remove |
40 Private method to check, if the given position is inside the remove |
40 icon. |
41 icon. |
41 |
42 |
42 @param pos position to check for (QPoint) |
43 @param pos position to check for |
43 @return flag indicating success (boolean) |
44 @type QPoint |
|
45 @return flag indicating success |
|
46 @rtype bool |
44 """ |
47 """ |
45 itm = self.itemAt(pos) |
48 itm = self.itemAt(pos) |
46 if itm is None: |
49 if itm is None: |
47 return False |
50 return False |
48 |
51 |
57 |
60 |
58 def mousePressEvent(self, evt): |
61 def mousePressEvent(self, evt): |
59 """ |
62 """ |
60 Protected method handling presses of mouse buttons. |
63 Protected method handling presses of mouse buttons. |
61 |
64 |
62 @param evt mouse press event (QMouseEvent) |
65 @param evt mouse press event |
|
66 @type QMouseEvent |
63 """ |
67 """ |
64 if self.__containsRemoveIcon(evt.position().toPoint()): |
68 if self.__containsRemoveIcon(evt.position().toPoint()): |
65 self.removeItemRequested.emit(self.itemAt(evt.position().toPoint())) |
69 self.removeItemRequested.emit(self.itemAt(evt.position().toPoint())) |
66 return |
70 return |
67 |
71 |
69 |
73 |
70 def mouseDoubleClickEvent(self, evt): |
74 def mouseDoubleClickEvent(self, evt): |
71 """ |
75 """ |
72 Protected method handling mouse double click events. |
76 Protected method handling mouse double click events. |
73 |
77 |
74 @param evt mouse press event (QMouseEvent) |
78 @param evt mouse press event |
|
79 @type QMouseEvent |
75 """ |
80 """ |
76 if self.__containsRemoveIcon(evt.position().toPoint()): |
81 if self.__containsRemoveIcon(evt.position().toPoint()): |
77 self.removeItemRequested.emit(self.itemAt(evt.position().toPoint())) |
82 self.removeItemRequested.emit(self.itemAt(evt.position().toPoint())) |
78 return |
83 return |
79 |
84 |