2011-05-20 17 views
0

我得到MouseEvent在網絡和解僱他們通過postEvent但不工作的Qt的MouseEvent仿真桌面

QApplication::postEvent(DG::Util::_desktopWidget, ev); 

DG ::的Util :: _ desktopWidget在_init

QDesktopWidget* desktopWidget = new QDesktopWidget;//desktopWidget is local 
DG::Util::_desktopWidget = desktopWidget->screen(desktopWidget->primaryScreen()); 
+0

我沒有使用過QDesktopWidget,也不知道它是否可以用這種方式使用。但是,您是否檢查過QDesktopWidget是否獲得該事件?你是否檢查QDesktopWidget是否有任何孩子? – Bart 2011-05-20 07:47:40

+0

'DG :: Util :: _ desktopWidget'類型爲'QWidget *',我如何檢查Wheather它是否獲得了mouseevent? – 2011-05-20 08:31:21

回答

0

被初始化有無你檢查了你從網絡上收到的事件(ev)是否有效?

無論如何,請嘗試使用QApplication::sendEvent來代替。

+0

Ya通過網絡正確收到 – 2011-05-21 05:16:48