WebView::keyPressEvent(QKeyEvent *event)

57 views
Skip to first unread message

BerenScott

unread,
Nov 30, 2011, 11:01:28 PM11/30/11
to arora-dev
Hello,

I am trying to place a call to keyPressEvent which basically hits the
enter key. Could someone please tell me how to structure that call?

Something like:

keyPressEvent(blah blah blah);

What do I put in blah blah blah?

Beren

Diego Iastrubni

unread,
Dec 1, 2011, 6:51:08 AM12/1/11
to aror...@googlegroups.com
This is a callback method, you need to overload it, not call it directly.

What are you trying to do? emulate a keypress?

Beren Scott

unread,
Dec 1, 2011, 7:05:10 AM12/1/11
to aror...@googlegroups.com


This is what will happen, I need to open up 5 new tabs, and then
automate the actions in each tab most of which will never be seen. So,
to do this, I want to put some code into the webview.cpp, so that when a
certain condition is met, on load, it will basically hit the enter key.

keyPressEvent exists within the webview.cpp, but I don't really know how
to call it. If I have to overload it, how exactly do I do that?

keyPressEvent << Qt::Key_Enter;

or something like that?

Beren

Diego Iastrubni

unread,
Dec 1, 2011, 8:07:55 AM12/1/11
to aror...@googlegroups.com
If you want to automate a GUI - there are better solutions (see http://www.froglogic.com/)
If you want to submit several forms - again, better place.

If you want something "else", I found this via a short google search. Please read it: http://stackoverflow.com/questions/2035310/how-can-i-simulate-user-interaction-key-press-event-in-qt

Beren Scott

unread,
Dec 1, 2011, 8:41:11 AM12/1/11
to aror...@googlegroups.com


Unfortunately, I wish to do it in the method I have specified. I wish to
send the enter key to multiple tabs using the keyPressEvent in
webview.cpp. Could you please just specify how I can go about doing
that? I'm fairly new at all of this. I have done a lot of work on this,
but just need to do that above mentioned action.

Beren

Diego Iastrubni

unread,
Dec 1, 2011, 9:00:18 AM12/1/11
to aror...@googlegroups.com
On Thu, Dec 1, 2011 at 3:41 PM, Beren Scott <beren...@iinet.net.au> wrote:
> If you want something "else", I found this via a short google search.
> Please read
> it: http://stackoverflow.com/questions/2035310/how-can-i-simulate-user-interaction-key-press-event-in-qt


Unfortunately, I wish to do it in the method I have specified. I wish to
send the enter key to multiple tabs using the keyPressEvent in
webview.cpp. Could you please just specify how I can go about doing
that? I'm fairly new at all of this. I have done a lot of work on this,
but just need to do that above mentioned action.


Please read the last link in the previous email (quoted here). 

Reply all
Reply to author
Forward
0 new messages