Results 1 to 2 of 2

Thread: How to post a key event to another application

  1. #1
    Join Date
    Jan 2006
    Posts
    3
    Qt products
    Qt4

    Default How to post a key event to another application

    Hi all, I placed some text in my QClipboard (Win32, Qt 4.1.0) and I would like to automatically paste it to the desktop window that has focus at the time. I tried to send a Ctrl+V key event as follows but with no success:

    QDesktopWidget* l_desktop = QApplication::desktop();
    QWidget* l_desktopWindowWithFocus = l_desktop->focusWidget();
    QApplication:ostEvent(l_desktopWindowWithFocus, new QKeyEvent(QEvent::KeyPress, Qt::Key_V, Qt::ControlModifier));

    The problem was that l_desktop->focusWidget(); returned NULL.

    Is what I want to do possible with Qt?

    thanks a lot,
    Dimitri

  2. #2
    Join Date
    Jan 2006
    Posts
    3
    Qt products
    Qt4

    Default Re: How to post a key event to another application

    Ok, I found that it is not possible. I have to use a platform specific solution.

Similar Threads

  1. Replies: 3
    Last Post: 8th December 2006, 18:51
  2. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55
  3. Replies: 3
    Last Post: 31st March 2006, 18:38
  4. What's the relationship between signal/slot and event?
    By twosnowman in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 17:13

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.