June 17, 2011

zither zither
Lab Rat
148 posts

How to get HTML code from selected text from Right Click Menu (Context Menu)?

 

How can I get data from selected text from Right Click Menu (Context Menu)?

How can I access that part of web page?

Thanks

7 replies

June 17, 2011

Stavros Filippidis Stavros Filippidis
Lab Rat
390 posts

Could you be a little more descriptive on your question? :-)

June 17, 2011

zither zither
Lab Rat
148 posts

In QWebView, ContextMenuEvent, how do I get selected text from QWebView via Rt Click

e.g, when we select “http://www.google.com” on QWebView contents, Rt Click on them -> Menu Appears -> “Chang with my Home Page” Click -> “http://www.google.com” on QWebView change to my home page address.
The interchange may be the other text or other words..

It like when we select URL address on browser, context Menu add option of “Open this in new Tab” although it’s not a hyperlink…
Thanks

June 17, 2011

loladiro loladiro
Lab Rat
596 posts

I’m not gonna do it for you, but have a look at this [doc.qt.nokia.com] and this [doc.qt.nokia.com]

June 17, 2011

jim_kaiser jim_kaiser
Lab Rat
144 posts

@loladiro: hehehe… :)

@zither: Come on man! As loladiro has posted above, just spend 2 mins with the documentation and problem solved!

I sometimes wonder if people are aware of the existence of Qt-Assistant!

June 17, 2011

zither zither
Lab Rat
148 posts

It’s OK, but one important is I want to change that selected text.. without touching another contents of web page..

I try to cut, but not work …
How can I do that? via WebPage Action? Plz point to me

Thanks

June 17, 2011

loladiro loladiro
Lab Rat
596 posts

The problem really is that selected text can span more than one element (or just parts of elements). WebKit is not MS Word. It is not that simple. You can play with WebAction and isEditable, but that’s more of a dirty hack than anything else. Maybe you can tell us more about the use case and we can guide you to a more appropriate solution.

June 17, 2011

zither zither
Lab Rat
148 posts

I’m trying to make a browser similar to other browser.
But like not other browser, it can convert to some specific Unicode words replace on incoming web page if loaded page has predefined such unicode character. I post previously for such answer How to get & change HTML data [developer.qt.nokia.com]

In firefox, similar function plugin & work well. It use javascript. I try to load that javascript funtion to QWebFrame but no change. When I convert all of HTML data from QWebView, web page like Facebook [facebook.com], Gtalk built-in with Gmail [mail.google.com] doesn’t work because they load dynamically…

So, I decided to convert the selected words upon Rt click & convert on request & show the converted words on QWebView in place of previously selected words…
That’s all what I want. Sorry for my English…

Thanks

 
  ‹‹ How to detect & catch data from part of web contents change?      JS garbage collection in QWebFrame or QWebView. ››

You must log in to post a reply. Not a member yet? Register here!