PDA

View Full Version : How to navigate between widget?



horoma
2nd January 2013, 09:03
Hi all,

I have a question on qtwebkit. Suppose that I turn on spatial navigation and I open a window.
The focus is setting on address bar, when I press left, I cannot move the focus out of the address bar.
What I want is that the focus can focus on icon which is located on the left of address bar.
Do you have any advise?

Regards,
Horoma

ChrisW67
2nd January 2013, 22:29
The "address bar" and other navigation widgets are not provided by QtWebKit.

My first piece of advice: don't do things in your UI that would not normally happen on the platform(s) you are targeting. I cannot recall any normal UI where pressing left with the cursor at the left end of a line edit would change the widget focus to an unrelated widget. An example I could think of where this might be desirable is if you have four separate text edits for the four components of an IPv4 address: but these are not unrelated widgets.

If you really want to do this then you could try overriding the line edit's keyReleaseEvent(), check if the key is Qt::Key_Left and the cursorPosition() is zero, then call setFocus() on the widget to the left.