Results 1 to 7 of 7

Thread: OnScreenKeyboard tab focus problem

  1. #1
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default OnScreenKeyboard tab focus problem

    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.

    Qt Code:
    1. QString qstrKeyId="0x01000001";
    2. int nKeyId = qstrKeyId.toInt(&bIsOk, 16);
    3. QString qstrKeyIdString=QChar(qstrKeyId.toInt(0, 16));
    4. QKeyEvent keyEvent(QEvent::KeyPress,nKeyId,Qt::NoModifier,qstrKeyIdString);
    5. QWidget *focusWidget = QApplication::focusWidget();
    6. if(focusWidget) /* send the key to focused widget */
    7. {
    8. QApplication::sendEvent(focusWidget, &keyEvent);
    9. }
    To copy to clipboard, switch view to plain text mode 



    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
    Last edited by BalaQT; 23rd March 2011 at 11:39. Reason: multipost fixed

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: OnScreenKeyboard tab focus problem

    Please don't multi post! it against the site rules!
    http://www.qtcentre.org/rules
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    BalaQT (23rd March 2011)

  4. #3
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: OnScreenKeyboard tab focus problem

    any guidance?
    Bala

  5. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: OnScreenKeyboard tab focus problem

    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.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  6. #5
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: OnScreenKeyboard tab focus problem

    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

  7. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: OnScreenKeyboard tab focus problem

    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!
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  8. #7
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: OnScreenKeyboard tab focus problem

    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.

Similar Threads

  1. Problem of Focus QMacNativeWidget
    By skuallpa in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2010, 14:19
  2. Focus problem
    By waynew in forum Qt Programming
    Replies: 4
    Last Post: 1st May 2010, 01:24
  3. QX11EmbedContainer problem with focus
    By PhoenixRevived in forum Qt Programming
    Replies: 0
    Last Post: 14th November 2007, 05:34
  4. Tab/Enter focus problem
    By b1 in forum Qt Programming
    Replies: 4
    Last Post: 23rd October 2006, 23:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.