Reputation: 12904
I want to Simulate a QKeyEvent
on the Currently Focused Widget. That widget Might not belong to My Application even the widget may not be an Qt Widget at all. I just want to Simulate a QKeyEvent On Whatever Widget In Focus now.
I've tried QApplication::postEvent(DG::Util::_desktopWidget, ev);
Where DG::Util::_desktopWidget
is the Primary Desktop Widget
QDesktopWidget* desktopWidget = new QDesktopWidget;
DG::Util::_desktopWidget = desktopWidget->screen(desktopWidget->primaryScreen());
But This doesn't work.
Upvotes: 1
Views: 299
Reputation: 9207
With Qt you can only control widgets belonging to your app. Therefore you can't send QKeyEvent to non-Qt apps, or Qt apps which are different processes.
Upvotes: 1