WebBrowser/WebBrowserView.py

branch
maintenance
changeset 5680
b93cb6353cc0
parent 5633
1a767ca5bbf3
parent 5631
d0beabfaad42
child 5730
6422afc7adc4
equal deleted inserted replaced
5655:884cd9c9ce05 5680:b93cb6353cc0
120 self.__mw.personalInformationManager().connectPage(self.page()) 120 self.__mw.personalInformationManager().connectPage(self.page())
121 121
122 self.__inspector = None 122 self.__inspector = None
123 WebInspector.registerView(self) 123 WebInspector.registerView(self)
124 124
125 if qVersion() >= "5.8.0":
126 lay = self.layout()
127 lay.currentChanged.connect(
128 lambda: QTimer.singleShot(0, self.__setRwhvqt))
129 self.__setRwhvqt()
130
125 self.grabGesture(Qt.PinchGesture) 131 self.grabGesture(Qt.PinchGesture)
132
133 def __setRwhvqt(self):
134 """
135 Private slot to set widget that receives input events.
136 """
137 self.grabGesture(Qt.PinchGesture)
138 self.__rwhvqt = self.focusProxy()
139 if self.__rwhvqt:
140 self.__rwhvqt.grabGesture(Qt.PinchGesture)
141 self.__rwhvqt.installEventFilter(self)
142 else:
143 print("Focus proxy is null!") # __IGNORE_WARNING_M801__
126 144
127 def __currentEngineChanged(self): 145 def __currentEngineChanged(self):
128 """ 146 """
129 Private slot to track a change of the current search engine. 147 Private slot to track a change of the current search engine.
130 """ 148 """
501 @param menu reference to the menu to be populated 519 @param menu reference to the menu to be populated
502 @type QMenu 520 @type QMenu
503 @param hitTest reference to the hit test object 521 @param hitTest reference to the hit test object
504 @type WebHitTestResult 522 @type WebHitTestResult
505 """ 523 """
506 # TODO: Qt 5.8 - add support for spell checking
507 spellCheckActionCount = 0 524 spellCheckActionCount = 0
508 if qVersion() >= "5.7.0": 525 if qVersion() >= "5.7.0":
509 contextMenuData = self.page().contextMenuData() 526 contextMenuData = self.page().contextMenuData()
510 hitTest.updateWithContextMenuData(contextMenuData) 527 hitTest.updateWithContextMenuData(contextMenuData)
511 528
1370 @type QEvent 1387 @type QEvent
1371 @return flag indicating that the event should be filtered out 1388 @return flag indicating that the event should be filtered out
1372 @rtype bool 1389 @rtype bool
1373 """ 1390 """
1374 # find the render widget receiving events for the web page 1391 # find the render widget receiving events for the web page
1375 if obj is self and evt.type() == QEvent.ChildAdded: 1392 if qVersion() < "5.8.0":
1376 child = evt.child() 1393 if obj is self and evt.type() == QEvent.ChildAdded:
1377 if child and child.inherits( 1394 child = evt.child()
1378 "QtWebEngineCore::RenderWidgetHostViewQtDelegateWidget"): 1395 if child and child.inherits(
1379 self.__rwhvqt = child 1396 "QtWebEngineCore::"
1380 self.grabGesture(Qt.PinchGesture) 1397 "RenderWidgetHostViewQtDelegateWidget"):
1381 self.__rwhvqt.grabGesture(Qt.PinchGesture) 1398 self.__rwhvqt = child
1382 self.__rwhvqt.installEventFilter(self) 1399 self.grabGesture(Qt.PinchGesture)
1400 self.__rwhvqt.grabGesture(Qt.PinchGesture)
1401 self.__rwhvqt.installEventFilter(self)
1383 1402
1384 # forward events to WebBrowserView 1403 # forward events to WebBrowserView
1385 if obj is self.__rwhvqt: 1404 if obj is self.__rwhvqt:
1386 wasAccepted = evt.isAccepted() 1405 wasAccepted = evt.isAccepted()
1387 evt.setAccepted(False) 1406 evt.setAccepted(False)

eric ide

mercurial