[Qt-interest] QWebView and backspace key
Constantin Makshin
cmakshin at gmail.com
Wed Feb 9 18:13:28 CET 2011
I think it wouldn't be a bad idea to file a feature request to make QWebPage able to not only return and trigger page actions, but also override and/or completely disable them — something like
QWebPage::setAction (WebAction webAction, QAction* action)
and
QWebPage::enableAction (WebAction action, bool enable).
This won't solve the problem "here and now", but may help you and others in the future. And definitely any of those solutions are better than manually clearing the page history each time it changes.
On Wednesday 09 February 2011 02:17:18 Crni Gorac wrote:
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110209/e0e20300/attachment.bin
More information about the Qt-interest-old
mailing list