Results 1 to 7 of 7

Thread: Discussion about developing an onscreen keyboard in Qt

  1. #1
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Discussion about developing an onscreen keyboard in Qt

    I want to make a small Qt application which will show an onscreen keyboard with 2-3 keys only. When i press a button on the on-screen keyboard using mouse, the corresponding key event should be sent to the active window. Active window in this case should not be the Qt application but the last active window on which the user clicked.

    An example of the above description can be found by running the Gnome on-screen keyboard i.e. GoK (http://www.gok.ca/).

    So, if the user has a text editor open in the background, he should be able to send keystrokes to the text editor by clicking on the onscreen keyboard application made in Qt. The onscreen keyboard should be visible at all times and should stay on top of other applications.

    Now, i don't know how to send events to the other application from Qt application i.e. how to make Qt application as an overlay application so that it stays in view all the time (similar to GoK) and sends events to other applications.

    I searched on the net and found that GoK uses AT SPI for sending key events but it might not be useful in my case as i don't want dependency on any window manager and AT SPI seems to be dependent on GNOME.

    Also, i think i can send events to other application using XSendEvent API of xwindows but i don't want X11 dependency either as my onscreen keyboard will run on an embedded device without X11.

    I found that i might be able to use DBus as an alternative to AT SPI but i don't know for sure.

    Please help me if anybody has an idea about it. I know how to send events to the linux applications by writing to the device file (/dev/input/event*) but i have no idea how to send events to other application without using X11 APIs.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Discussion about developing an onscreen keyboard in Qt

    I don't think DBus itself will allow you to send events to an arbitrary application. In my opinion you should go with X11 and have an ifdef block in your code to handle special cases and those probably depend on the "windowing system" that is running on the device. If you use Qtopia then there is a chance you can communicate with the layer but you have to check its API, maybe there is a way to do what you want.

  3. #3
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Discussion about developing an onscreen keyboard in Qt

    ya, i can put the X11 code inside ifdef but i want to know what solution i can use in case X11 is not present.
    Not sure if QTopia will have any specific APIs for this as this requirement is valid for a normal desktop as well, so even Qt should have support for it.
    I think we can also use Qt's sendEvent or postEvent to send events to other windows but i am not sure if using these APIs we can send events to other applications.

    and how can we show an overlay window which always stays on top but still allows focus to be on other applications (just like GoK does)?
    Last edited by montylee; 2nd January 2009 at 20:11.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Discussion about developing an onscreen keyboard in Qt

    Qt uses X11 so it doesn't need any support for non-X11 environments. Qtopia doesn't use X11 (or at least it doesn't have to), it uses its own integrated pseudo-window manager, so the window manager might have support for transfering events into another application. At worst you can probably use QCopChannel for that although I guess the other application would need to be aware of it (like with D-Bus).

  5. #5
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Discussion about developing an onscreen keyboard in Qt

    ya, Qtopia uses its own window manager. I am not sure whether to use Qtopia or Qt/Embedded. Does Qt/Embedded has its own window manager too?

    Basically the on-screen keyboard will be used for opera browser, so when user clicks buttons on the on-screen keyboard it should be propagated to opera.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Discussion about developing an onscreen keyboard in Qt

    Qt/Embedded and Qtopia are/used to be the same thing. Now we have Qt Embedded which is a "middle" layer for embedded systems (including the wm) and Qt Extended (which used to be called Qtopia Core, I think) which is an "upper" layer for embedded systems that contains things like GSM support, text messages, contacts, etc.

    Doesn't Opera need X11 (and Qt3 by the way)?

  7. #7
    Join Date
    Oct 2007
    Location
    India
    Posts
    162
    Thanks
    20
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Discussion about developing an onscreen keyboard in Qt

    thanks for the info regarding Qtopia and Qt/Embedded.
    Opera does need Qt3 and we have Qt3 libraries on the embedded hardware so opera runs fine on it. I am not sure if Opera needs X11, it shouldn't since our older hardware doesn't have X11.

    I still don't know what to do for transfering events to other applications.

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.