Results 1 to 4 of 4

Thread: Q Virtual Keyboard (XTestFakeKeyEvent) running within other Qt App. Focus problem?

  1. #1
    Join Date
    Jun 2011
    Posts
    23
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Unhappy Q Virtual Keyboard (XTestFakeKeyEvent) running within other Qt App. Focus problem?

    Hello,

    I have been using the following keyboard as a standalone application

    http://qt-apps.org/content/show.php/...?content=77983

    and it works great.

    I wish to integrate this application into an exisiting product. I have a toolbar (QWidget) with buttons and edit boxes, i also have a display (QWidget), both are separate classes that are stared up in main() with 'new'. On the toolbar I have a QToolButton that when i press i wish to activate the qvkeyboard, when i press again i wish to close the qvkeyboard. I have attempted to do this 2 ways, both have problems though.

    1.Use QProcess which calls proc->start("./qvkeyboard"). This works and qvkeyboard is able to be used/interacts with QLineEdit etc on the toolbar that the QToolbutton is on. Problem I have is that when i press the QToolButton again to close the qvkeyboard it won't. I have tried proc->kill and proc->terminate and it does nothing. Is there a way to send a signal/slot to a proc, or a message somehow?

    2. I have intergrated the qvkeyboard code into my existing produce (called it KeyPadwindow). I create it with
    Qt Code:
    1. KeyPadwindow = new Q_KeyPadwindow(0, Qt::FramelessWindowHint|Qt::WindowStaysOnTop)
    To copy to clipboard, switch view to plain text mode 
    at system start up then use
    Qt Code:
    1. KeyPadWindow->show()
    To copy to clipboard, switch view to plain text mode 
    When the QToolButton is pressed
    This show command opens the KeyPadwindow but it will not interact with the QLineEdit boxes in the toolbar. Do i need to get focus? Does the XTestFakeKeyEvent only send fake key to application outside the one that the code is being run?

    I think that instead of using XTestFakeKeyEvent that i could use signals/slots but i would need to create a QKeyEvent for all the keys on the keyboard and this seems a messy way. Also how do i determine where the focus is between my 2 widgets (toolbar and display)? I need to be able to send key presses to both depending on where the focus is.
    Depending on the key pressed can the focus be changed between the two? I don't really understand QFocus...


    Hope that makes sense and some kind person can help

    cheers,
    X_Key_confused....

  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: Q Virtual Keyboard (XTestFakeKeyEvent) running within other Qt App. Focus problem

    I have tried proc->kill and proc->terminate and it does nothing.
    I have intergrated the qvkeyboard code into my existing produce
    I don't understand: do you use the virtual keyboard as a QProcess or do you use it inside your code?
    ==========================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. #3
    Join Date
    Jun 2011
    Posts
    23
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Q Virtual Keyboard (XTestFakeKeyEvent) running within other Qt App. Focus problem

    I have tried it both ways, as a QProcess and as integrated inside the code (not at the same time)

    proc->kill now works, not sure why it didn't before, but i would much prefer to integrate it into the code rather than a QProcess but it doesn't seem to get the focus for the widgets correct when inside the code?

    Thanks

  4. #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: Q Virtual Keyboard (XTestFakeKeyEvent) running within other Qt App. Focus problem

    but it doesn't seem to get the focus for the widgets correct when inside the code?
    You didn't provide any details to the code so its hard to say...
    ==========================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.

Similar Threads

  1. Virtual Keyboard
    By NoRulez in forum Qt Programming
    Replies: 9
    Last Post: 5th August 2010, 07:02
  2. How to get the virtual keyboard?
    By ramesh.bs in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 2nd June 2010, 11:58
  3. Virtual Keyboard?
    By augusbas in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 14th July 2009, 08:55
  4. like virtual keyboard?
    By triperzonak in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2008, 16:42
  5. virtual keyboard
    By sar_van81 in forum Qt Programming
    Replies: 5
    Last Post: 22nd December 2006, 13:40

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.