src/eric7/QtHelpInterface/HelpTocWidget.py

branch
eric7
changeset 10431
64157aeb0312
parent 10029
d9f2fa14cc65
child 10439
21c28b0f9e41
equal deleted inserted replaced
10430:e440aaf179ce 10431:64157aeb0312
115 115
116 def expandToDepth(self, depth): 116 def expandToDepth(self, depth):
117 """ 117 """
118 Public slot to expand the table of contents to a specific depth. 118 Public slot to expand the table of contents to a specific depth.
119 119
120 @param depth depth to expand to (integer) 120 @param depth depth to expand to
121 @type int
121 """ 122 """
122 self.__expandDepth = depth 123 self.__expandDepth = depth
123 if depth == -1: 124 if depth == -1:
124 self.__tocWidget.expandAll() 125 self.__tocWidget.expandAll()
125 else: 126 else:
127 128
128 def focusInEvent(self, evt): 129 def focusInEvent(self, evt):
129 """ 130 """
130 Protected method handling focus in events. 131 Protected method handling focus in events.
131 132
132 @param evt reference to the focus event object (QFocusEvent) 133 @param evt reference to the focus event object
134 @type QFocusEvent
133 """ 135 """
134 if evt.reason() != Qt.FocusReason.MouseFocusReason: 136 if evt.reason() != Qt.FocusReason.MouseFocusReason:
135 self.__tocWidget.setFocus() 137 self.__tocWidget.setFocus()
136 138
137 def keyPressEvent(self, evt): 139 def keyPressEvent(self, evt):
138 """ 140 """
139 Protected method handling key press events. 141 Protected method handling key press events.
140 142
141 @param evt reference to the key press event (QKeyEvent) 143 @param evt reference to the key press event
144 @type QKeyEvent
142 """ 145 """
143 if evt.key() == Qt.Key.Key_Escape: 146 if evt.key() == Qt.Key.Key_Escape:
144 self.escapePressed.emit() 147 self.escapePressed.emit()
145 148
146 def syncToContent(self, url): 149 def syncToContent(self, url):
147 """ 150 """
148 Public method to sync the TOC to the displayed page. 151 Public method to sync the TOC to the displayed page.
149 152
150 @param url URL of the displayed page (QUrl) 153 @param url URL of the displayed page
151 @return flag indicating a successful synchronization (boolean) 154 @type QUrl
155 @return flag indicating a successful synchronization
156 @rtype bool
152 """ 157 """
153 idx = self.__tocWidget.indexOf(url) 158 idx = self.__tocWidget.indexOf(url)
154 if not idx.isValid(): 159 if not idx.isValid():
155 return False 160 return False
156 self.__tocWidget.setCurrentIndex(idx) 161 self.__tocWidget.setCurrentIndex(idx)
158 163
159 def __showContextMenu(self, pos): 164 def __showContextMenu(self, pos):
160 """ 165 """
161 Private slot showing the context menu. 166 Private slot showing the context menu.
162 167
163 @param pos position to show the menu at (QPoint) 168 @param pos position to show the menu at
169 @type QPoint
164 """ 170 """
165 if not self.__tocWidget.indexAt(pos).isValid(): 171 if not self.__tocWidget.indexAt(pos).isValid():
166 return 172 return
167 173
168 model = self.__tocWidget.model() 174 model = self.__tocWidget.model()

eric ide

mercurial