I am using QWebView from PyQT4. I’d like to
- highlight terms of a webpage.
- do a keyboard navigation inside a webpage (for example Ctrl-N move to next link)
is it possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
not trivial, but possible. You could use the toHtml method of your
QWebViewinstance, parse it e.g. with BeautifulSoup (be sure to stick with 3.0.9!-), insert a<span class="myhilite">...</span>around whatever terms you like (as well as the CSS to define exactly what visual effects classmyhiliteis going to have), and put the modified HTML back with thesetHtml— phew;-).I guess you could, by using the appropriate functionality that
QWebViewinherits from QWidget (I don’t thinkQWebViewadds any extra relevant functionality of its own), e.g. grabKeyboard if you want to grab all keyboard events, or maybe addAction with an appropriate shortcut — but I’m not sure exactly what you want to happen when control-N is pressed, so this one is iffier. Maybe you can clarify in terms of the many possible methods ofQWebView,QWidget, etc…?