PDA

View Full Version : OnScreenKeyboard tab focus problem



BalaQT
23rd March 2011, 09:58
hi experts,
My environment is linux openembedded , qt 4.7(embedded).
I'm implementing a onscreen keyboard. No physical keyboard is not attached to the device.
Using the following code Im sending the keypress events to the current window having lineedits.



QString qstrKeyId="0x01000001";
int nKeyId = qstrKeyId.toInt(&bIsOk, 16);
QString qstrKeyIdString=QChar(qstrKeyId.toInt(0, 16));
QKeyEvent keyEvent(QEvent::KeyPress,nKeyId,Qt::NoModifier,qs trKeyIdString);
QWidget *focusWidget = QApplication::focusWidget();
if(focusWidget) /* send the key to focused widget */
{
QApplication::sendEvent(focusWidget, &keyEvent);
}



My problems are
1) when I press the onscreen tab key, the navigation is working good, but i cant see the blinking cursor in the lineedits.
when the line edit is having no texts , the blinking cursor in the lineedit is not visible.
But when the lineedit is having some texts, the blinking cursor in the lineedit is visible.
This problem is only with the openembedded. In Ubuntu pC, i can see the vertical beamer in the empty linedit.


In summarize, my problem is: when i press tab key, I cant find the vertical text cursor in the empty lineedits.
my question is: How to show the vertical beamer in the empty lineedit.
Im sending the tab key value(0x01000001) using sendevent, is there any problem?


2)when i press the tab, the backspace key functionality is not working.But backspace functionality is working well for otherkeys.
may be the focus problem affects this also. So, when pressing the tabkey, how to set the focus on the lineedit?



Any hints?
(sorry for the multiposting)
Thanks
Bala

high_flyer
23rd March 2011, 10:10
Please don't multi post! it against the site rules!
http://www.qtcentre.org/rules

BalaQT
24th March 2011, 07:28
any guidance?
Bala

high_flyer
24th March 2011, 09:45
when i press the tab, the backspace key functionality is not working.But backspace functionality is working well for otherkeys.
may be the focus problem affects this also. So, when pressing the tabkey, how to set the focus on the lineedit?
This part suggests to me, that there is a problem with the focus, which then might explain why you don't see the cursor.
Tab should shift focus to the next tab index widget, but your code only gets the current focused widget - maybe that is the problem.

BalaQT
25th March 2011, 05:55
hi high_flyer,
thnks for ur time and reply.

This part suggests to me, that there is a problem with the focus, which then might explain why you don't see the cursor.
yes, some problem in setting the focus when using onscreen tab key.
Interestingly i found that when i directly touch the lineedit(having some text) the vertical beamer is
blinking .
but when i press the tab key, the beamer in linedit(having some text) is visible but its not blinking.
when i type some characters in lineedit using onscreen keyboard, the beamer is visible but its not blinking.

This problem comes only in openembedded. in ubuntu pc the cursor is blinking well for the above scenario.

may be the implementation is wrong(the focuswidget and sendkeyevents)
or some problem with the sending keyevents QKeyEvent keyEvent(QEvent::KeyPress,nKeyId,Qt::NoModifier,qs trKeyIdString);

still not able to find why the beamer is not blinking?

Bala

high_flyer
25th March 2011, 10:03
The cursor will blink if you have focus on the line edit.
You need to shift focus to the next tab index widget, which you are NOT doing!

MarekR22
25th March 2011, 10:13
See this: QInputMethodEvent, QWidget::inputMethodEvent.

Another thing you have to disable focus in your virtual keyboard (QWidget::focusPolicy-prop), to prevent change of focus when you typing on it! Focus is moved to last clicked place which is focusable.