Results 1 to 8 of 8

Thread: Raise key pressed event when button is clicked?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Location
    Sweden
    Posts
    14
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    3

    Default Raise key pressed event when button is clicked?

    Hi,
    I'm developing an embedded Qt application where the only input method will be using the touchscreen and have made a virtual keyboard mapped with QSignalMapper. When a user presses (touches, clicks) a button on the virtual keyboard I would like the same behaviour as if a real keyboard was used. How do I do that? I figure it should be something like:

    Qt Code:
    1. void Widget::keySelected (const QString& key) {
    2. int i = key.at(0).toAscii();
    3. QKeyEvent::QKeyEvent ( QEvent::KeyPress, i, Qt::NoModifier, key, false, 1);
    4. }
    To copy to clipboard, switch view to plain text mode 
    But that doesn't work.

    The following code:
    Qt Code:
    1. void Widget::keySelected (const QString& key) {
    2. qDebug() << key;
    3. }
    To copy to clipboard, switch view to plain text mode 
    gives the output of the keyvalue, e.g. "A" if the A-button is pressed.

    Would be greatful if someone has a hint here
    Last edited by newstead; 4th June 2009 at 10:07.

Similar Threads

  1. button background color when it is clicked
    By navi1084 in forum Qt Programming
    Replies: 5
    Last Post: 24th June 2024, 12:09
  2. Hot plug and button event
    By kpmsivachand in forum Qt Programming
    Replies: 6
    Last Post: 16th July 2013, 06:49
  3. Replies: 4
    Last Post: 19th February 2009, 11:10
  4. Getting the row for button pressed
    By steg90 in forum Qt Programming
    Replies: 2
    Last Post: 28th November 2007, 15:45
  5. Mouse Over event on button
    By vishal.chauhan in forum Qt Programming
    Replies: 9
    Last Post: 10th January 2007, 05:03

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.