Found the problem.
The original code is fine.
The problem is that I had to define the same key combination (Alt+Q in my case) on Extensions page under "Keyboard shortcuts".