title: How to listen global mouse and keyboard events on linux platform using Qt?
body: <p>I use Qt to develop my application, and I want to listen the global mouse and keyboard events, so I can do something after detect these events. On windows platform, I use SetWindowsHookEx API. But I don't know how to do the similar thing on Linux. </p>
  
  <p>My code on Windows as below:</p>
  
  <pre><code>/*********************listen mouse event*****************************/
  mouseHook = SetWindowsHookEx(WH_MOUSE_LL, mouseProc, NULL, 0);
  if (mouseHook == NULL) {
  qDebug() &lt;&lt; "Mouse Hook Failed";
  }
  /*********************listen keyboard event*****************************/
  keyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, keyBoardProc, NULL, 0);
  if (keyboardHook == NULL) {
  qDebug() &lt;&lt; "Keyboard Hook Failed";
  }
  </code></pre>
  
  <p>Thank you for your answer sincerely!</p>