WebBrowser/WebBrowserPage.py

changeset 4925
6534062014dc
parent 4917
682750cc7bd5
child 4964
a894e8c92369
equal deleted inserted replaced
4924:040e36a60b1b 4925:6534062014dc
12 try: 12 try:
13 str = unicode # __IGNORE_EXCEPTION__ 13 str = unicode # __IGNORE_EXCEPTION__
14 except NameError: 14 except NameError:
15 pass 15 pass
16 16
17 from PyQt5.QtCore import QUrl, QTimer, QEventLoop 17 from PyQt5.QtCore import QUrl, QTimer, QEventLoop, QPoint
18 from PyQt5.QtGui import QDesktopServices 18 from PyQt5.QtGui import QDesktopServices
19 from PyQt5.QtWebEngineWidgets import QWebEnginePage 19 from PyQt5.QtWebEngineWidgets import QWebEnginePage
20 from PyQt5.QtWebChannel import QWebChannel 20 from PyQt5.QtWebChannel import QWebChannel
21 21
22 from WebBrowser.WebBrowserWindow import WebBrowserWindow 22 from WebBrowser.WebBrowserWindow import WebBrowserWindow
168 self.runJavaScript( 168 self.runJavaScript(
169 "window.scrollTo(window.scrollX + {0}, window.scrollY + {1})" 169 "window.scrollTo(window.scrollX + {0}, window.scrollY + {1})"
170 .format(x, y) 170 .format(x, y)
171 ) 171 )
172 172
173 def mapToViewport(self, pos):
174 """
175 Public method to map a position to the viewport.
176
177 @param pos position to be mapped
178 @type QPoint
179 @return viewport position
180 @rtype QPoint
181 """
182 return QPoint(pos.x() // self.zoomFactor(),
183 pos.y() // self.zoomFactor())
184
173 def hitTestContent(self, pos): 185 def hitTestContent(self, pos):
174 """ 186 """
175 Public method to test the content at a specified position. 187 Public method to test the content at a specified position.
176 188
177 @param pos position to execute the test at 189 @param pos position to execute the test at

eric ide

mercurial