E-book viewer: Fix dragging to select text with the mouse causing the page to slide sideways in paged mode, if the mouse leaves the text area. Fixes #1464862 [Page slides sideways when selecting text in reader](https://bugs.launchpad.net/calibre/+bug/1464862)

This commit is contained in:
Kovid Goyal 2015-06-18 05:52:11 +05:30
parent e87b7f8d3d
commit b48d401ac2

View File

@ -1369,6 +1369,13 @@ class DocumentView(QWebView): # {{{
return True
return QWebView.event(self, ev)
def mouseMoveEvent(self, ev):
if self.document.in_paged_mode and ev.buttons() & Qt.LeftButton and not self.rect().contains(ev.pos(), True):
# Prevent this event from causing WebKit to scroll the viewport
# See https://bugs.launchpad.net/bugs/1464862
return
return QWebView.mouseMoveEvent(self, ev)
def mouseReleaseEvent(self, ev):
r = self.document.mainFrame().hitTestContent(ev.pos())
a, url = r.linkElement(), r.linkUrl()