WebBrowser/WebBrowserPage.py

changeset 4925
6534062014dc
parent 4917
682750cc7bd5
child 4964
a894e8c92369
--- a/WebBrowser/WebBrowserPage.py	Mon Apr 04 18:08:37 2016 +0200
+++ b/WebBrowser/WebBrowserPage.py	Sat Apr 09 11:05:39 2016 +0200
@@ -14,7 +14,7 @@
 except NameError:
     pass
 
-from PyQt5.QtCore import QUrl, QTimer, QEventLoop
+from PyQt5.QtCore import QUrl, QTimer, QEventLoop, QPoint
 from PyQt5.QtGui import QDesktopServices
 from PyQt5.QtWebEngineWidgets import QWebEnginePage
 from PyQt5.QtWebChannel import QWebChannel
@@ -170,6 +170,18 @@
             .format(x, y)
         )
     
+    def mapToViewport(self, pos):
+        """
+        Public method to map a position to the viewport.
+        
+        @param pos position to be mapped
+        @type QPoint
+        @return viewport position
+        @rtype QPoint
+        """
+        return QPoint(pos.x() // self.zoomFactor(),
+                      pos.y() // self.zoomFactor())
+    
     def hitTestContent(self, pos):
         """
         Public method to test the content at a specified position.

eric ide

mercurial