360 |
360 |
361 def unselect(self): |
361 def unselect(self): |
362 """ |
362 """ |
363 Public slot to clear the current selection. |
363 Public slot to clear the current selection. |
364 """ |
364 """ |
365 if qVersionTuple() >= (5, 7, 0): |
365 try: |
366 self.triggerPageAction(QWebEnginePage.Unselect) |
366 self.triggerPageAction(QWebEnginePage.Unselect) |
367 else: |
367 except AttributeError: |
|
368 # prior to 5.7.0 |
368 self.page().runJavaScript( |
369 self.page().runJavaScript( |
369 "window.getSelection().empty()", |
370 "window.getSelection().empty()", |
370 WebBrowserPage.SafeJsWorld) |
371 WebBrowserPage.SafeJsWorld) |
371 |
372 |
372 def isForwardAvailable(self): |
373 def isForwardAvailable(self): |
543 @type QMenu |
544 @type QMenu |
544 @param hitTest reference to the hit test object |
545 @param hitTest reference to the hit test object |
545 @type WebHitTestResult |
546 @type WebHitTestResult |
546 """ |
547 """ |
547 spellCheckActionCount = 0 |
548 spellCheckActionCount = 0 |
548 if qVersionTuple() >= (5, 7, 0): |
549 if qVersionTuple() >= (5, 7, 0) and PYQT_VERSION >= 0x50700: |
549 contextMenuData = self.page().contextMenuData() |
550 contextMenuData = self.page().contextMenuData() |
550 hitTest.updateWithContextMenuData(contextMenuData) |
551 hitTest.updateWithContextMenuData(contextMenuData) |
551 |
552 |
552 if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800 and \ |
553 if qVersionTuple() >= (5, 8, 0) and PYQT_VERSION >= 0x50800 and \ |
553 bool(contextMenuData.misspelledWord()): |
554 bool(contextMenuData.misspelledWord()): |