eric6/WebBrowser/QtHelp/HelpIndexWidget.py

changeset 7269
0c63ea7f94bd
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7268:a28338eaf694 7269:0c63ea7f94bd
7 Module implementing a window for showing the QtHelp index. 7 Module implementing a window for showing the QtHelp index.
8 """ 8 """
9 9
10 10
11 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl, QEvent 11 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl, QEvent
12 from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QLineEdit, QMenu, \ 12 from PyQt5.QtWidgets import (
13 QDialog, QApplication 13 QWidget, QVBoxLayout, QLabel, QLineEdit, QMenu, QDialog, QApplication
14 )
14 15
15 16
16 class HelpIndexWidget(QWidget): 17 class HelpIndexWidget(QWidget):
17 """ 18 """
18 Class implementing a window for showing the QtHelp index. 19 Class implementing a window for showing the QtHelp index.
82 @type Qt.KeyboardModifiers or None 83 @type Qt.KeyboardModifiers or None
83 """ 84 """
84 if modifiers is None: 85 if modifiers is None:
85 modifiers = QApplication.keyboardModifiers() 86 modifiers = QApplication.keyboardModifiers()
86 if not url.isEmpty() and url.isValid(): 87 if not url.isEmpty() and url.isValid():
87 if modifiers & (Qt.ControlModifier | Qt.ShiftModifier) == \ 88 if (
88 (Qt.ControlModifier | Qt.ShiftModifier): 89 modifiers & (Qt.ControlModifier | Qt.ShiftModifier) ==
90 (Qt.ControlModifier | Qt.ShiftModifier)
91 ):
89 self.newBackgroundTab.emit(url) 92 self.newBackgroundTab.emit(url)
90 elif modifiers & Qt.ControlModifier: 93 elif modifiers & Qt.ControlModifier:
91 self.newTab.emit(url) 94 self.newTab.emit(url)
92 elif modifiers & Qt.ShiftModifier: 95 elif modifiers & Qt.ShiftModifier:
93 self.newWindow.emit(url) 96 self.newWindow.emit(url)
169 172
170 @param watched the QObject being watched (QObject) 173 @param watched the QObject being watched (QObject)
171 @param event the event that occurred (QEvent) 174 @param event the event that occurred (QEvent)
172 @return flag indicating whether the event was handled (boolean) 175 @return flag indicating whether the event was handled (boolean)
173 """ 176 """
174 if self.__searchEdit and watched == self.__searchEdit and \ 177 if (
175 event.type() == QEvent.KeyPress: 178 self.__searchEdit and watched == self.__searchEdit and
179 event.type() == QEvent.KeyPress
180 ):
176 idx = self.__index.currentIndex() 181 idx = self.__index.currentIndex()
177 if event.key() == Qt.Key_Up: 182 if event.key() == Qt.Key_Up:
178 idx = self.__index.model().index( 183 idx = self.__index.model().index(
179 idx.row() - 1, idx.column(), idx.parent()) 184 idx.row() - 1, idx.column(), idx.parent())
180 if idx.isValid(): 185 if idx.isValid():

eric ide

mercurial