583 @type QMenu |
583 @type QMenu |
584 @param hitTest reference to the hit test object |
584 @param hitTest reference to the hit test object |
585 @type WebHitTestResult |
585 @type WebHitTestResult |
586 """ |
586 """ |
587 spellCheckActionCount = 0 |
587 spellCheckActionCount = 0 |
588 contextMenuData = self.page().contextMenuData() |
588 contextMenuData = self.lastContextMenuRequest() |
589 hitTest.updateWithContextMenuData(contextMenuData) |
589 hitTest.updateWithContextMenuData(contextMenuData) |
590 |
590 |
591 if bool(contextMenuData.misspelledWord()): |
591 if bool(contextMenuData.misspelledWord()): |
592 boldFont = menu.font() |
592 boldFont = menu.font() |
593 boldFont.setBold(True) |
593 boldFont.setBold(True) |
1158 if isinstance(data, QUrl) and data.isEmpty(): |
1158 if isinstance(data, QUrl) and data.isEmpty(): |
1159 return |
1159 return |
1160 |
1160 |
1161 if isinstance(data, QUrl): |
1161 if isinstance(data, QUrl): |
1162 data = data.toString() |
1162 data = data.toString() |
1163 QApplication.clipboard().setText(data) |
1163 |
|
1164 # copy the URL to both clipboard areas |
|
1165 QApplication.clipboard().setText(data, QClipboard.Mode.Clipboard) |
|
1166 QApplication.clipboard().setText(data, QClipboard.Mode.Selection) |
1164 |
1167 |
1165 def __downloadLink(self): |
1168 def __downloadLink(self): |
1166 """ |
1169 """ |
1167 Private slot to download a link and save it to disk. |
1170 Private slot to download a link and save it to disk. |
1168 """ |
1171 """ |
1383 @param evt reference to the mouse event (QMouseEvent) |
1386 @param evt reference to the mouse event (QMouseEvent) |
1384 """ |
1387 """ |
1385 if WebBrowserWindow.autoScroller().mousePress(self, evt): |
1388 if WebBrowserWindow.autoScroller().mousePress(self, evt): |
1386 evt.accept() |
1389 evt.accept() |
1387 return |
1390 return |
1388 |
|
1389 self.__mw.setEventMouseButtons(evt.buttons()) |
|
1390 self.__mw.setEventKeyboardModifiers(evt.modifiers()) |
|
1391 |
|
1392 if evt.button() == Qt.MouseButton.XButton1: |
|
1393 self.pageAction(QWebEnginePage.WebAction.Back).trigger() |
|
1394 evt.accept() |
|
1395 elif evt.button() == Qt.MouseButton.XButton2: |
|
1396 self.pageAction(QWebEnginePage.WebAction.Forward).trigger() |
|
1397 evt.accept() |
|
1398 |
1391 |
1399 def _mouseReleaseEvent(self, evt): |
1392 def _mouseReleaseEvent(self, evt): |
1400 """ |
1393 """ |
1401 Protected method called by a mouse release event. |
1394 Protected method called by a mouse release event. |
1402 |
1395 |
1408 |
1401 |
1409 accepted = evt.isAccepted() |
1402 accepted = evt.isAccepted() |
1410 self.__page.event(evt) |
1403 self.__page.event(evt) |
1411 if ( |
1404 if ( |
1412 not evt.isAccepted() and |
1405 not evt.isAccepted() and |
1413 self.__mw.eventMouseButtons() & Qt.MouseButton.MiddleButton |
1406 evt.button() == Qt.MouseButton.MiddleButton |
1414 ): |
1407 ): |
1415 url = QUrl(QApplication.clipboard().text( |
1408 url = QUrl(QApplication.clipboard().text( |
1416 QClipboard.Mode.Selection)) |
1409 QClipboard.Mode.Selection)) |
1417 if ( |
1410 if ( |
1418 not url.isEmpty() and |
1411 not url.isEmpty() and |
1419 url.isValid() and |
1412 url.isValid() and |
1420 url.scheme() != "" |
1413 url.scheme() != "" |
1421 ): |
1414 ): |
1422 self.__mw.setEventMouseButtons(Qt.MouseButton.NoButton) |
|
1423 self.__mw.setEventKeyboardModifiers( |
|
1424 Qt.KeyboardModifier.NoModifier) |
|
1425 self.setSource(url) |
1415 self.setSource(url) |
1426 evt.setAccepted(accepted) |
1416 evt.setAccepted(accepted) |
1427 |
1417 |
1428 def _mouseMoveEvent(self, evt): |
1418 def _mouseMoveEvent(self, evt): |
1429 """ |
1419 """ |