[Qt-interest] QWebView and backspace key

Crni Gorac cgorac at gmail.com
Wed Feb 9 00:17:18 CET 2011


On Tue, Feb 8, 2011 at 11:00 PM, Crni Gorac <cgorac at gmail.com> wrote:
> Working on Qt-based application that is using Qt WebKit window as main
> user interface, with some HTML contents downloaded in-there from the
> corresponding server, and interaction handled mostly by JavaScript.
> This works fine, but I have problem that QWebView is reloading pages
> backwards from history when Backspace button pressed.  I tried number
> of things to stop this behavior: I tried to disable corresponding
> pageAction() but that has no effect, I tried with ignoring backspace
> key in keyPressEvent() override in my QWebView derived class, but then
> backspace is not working on some line edit widgets created by
> JavaScript and needed in this particular application.  I can see from
> QWebPage source code that QWebPage::Back action is triggered on
> backspace button deeply in QWebPagePrivate::keyPressEvent(), doesn't
> seem to me like that could be changed...  So - is there any way to
> disable this?
>

OK - as a sort of solution, I found I can catch
saveFrameStateRequested signal from page() in my  QWebView derived
class, and call history()->clear() on this.  Not perfect solution, but
sorta works.  If anyone has better proposal, it would be great to
know.

Regards.



More information about the Qt-interest-old mailing list