I tried to change the test's class from QTextEdit and QWidget and it actually works!
But... I think I have some focus problem, 'cause in my main class it doesn't work.

I tried to set focuspolicy to tabfocus, focus to tabfocusreason, with no advantage.
I tried grabkeyboard() but it says
Qt Code:
  1. X Error: BadWindow (invalid Window parameter) 3
  2. Major opcode: 31 (X_GrabKeyboard)
  3. Resource id: 0x0
To copy to clipboard, switch view to plain text mode 

what could I do?