WebBrowser/Tools/WebHitTestResult.py

changeset 5530
93f95c4b3153
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
equal deleted inserted replaced
5527:4fdbb36fe794 5530:93f95c4b3153
104 return res; 104 return res;
105 }})() 105 }})()
106 """.format(self.__viewportPos.x(), self.__viewportPos.y()) 106 """.format(self.__viewportPos.x(), self.__viewportPos.y())
107 self.__populate(page.url(), page.execJavaScript(script)) 107 self.__populate(page.url(), page.execJavaScript(script))
108 108
109 def updateWithContextMenuData(self, data):
110 """
111 Public method to update the hit test data with data from the context
112 menu event.
113
114 Note: This works for Qt >= 5.7.0.
115
116 @param data context menu data
117 @type QWebEngineContextMenuData
118 """
119 from PyQt5.QtWebEngineWidgets import QWebEngineContextMenuData
120 if not data.isValid() or data.position() != self.__pos:
121 return
122
123 self.__linkTitle = data.linkText()
124 self.__linkUrl = data.linkUrl()
125 self.__isContentEditable = data.isContentEditable()
126 self.__isContentSelected = bool(data.selectedText())
127
128 if data.mediaType() == QWebEngineContextMenuData.MediaTypeImage:
129 self.__imageUrl = data.mediaUrl()
130 elif data.mediaType() in [QWebEngineContextMenuData.MediaTypeAudio,
131 QWebEngineContextMenuData.MediaTypeVideo]:
132 self.__mediaUrl = data.mediaUrl()
133
109 def baseUrl(self): 134 def baseUrl(self):
110 """ 135 """
111 Public method to get the base URL of the page. 136 Public method to get the base URL of the page.
112 137
113 @return base URL 138 @return base URL

eric ide

mercurial