开发者

Simulate QKeyEvent on Whatever Widget InFocus

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 D开发者_StackOverflow社区esktop Widget

QDesktopWidget* desktopWidget = new QDesktopWidget;
DG::Util::_desktopWidget = desktopWidget->screen(desktopWidget->primaryScreen());

But This doesn't work.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜