Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, October 2001
How do I a global accelerator (a key-sequence which I can catch even without having focus) ?


Message 1 in thread

        Hello All.
  I have a problem. I'm writing a qt-based dictionary and I want to show it's 
window only when the user press the key-sequence (e.g. CTRL+ALT+T). So in any 
time before my appication don't have focus so can't use ordinary accelerator. 
  I think the right way to make this work is to put my own event-processing 
function (a hook) directly in X event queue. Doing so I could intercept _all_ 
key-press events and react them. Qt offers the way to do similar thing, there 
is installEventFilter function. It requires QWidget object which for it is 
called. But I can't get QWidget object even for KDE-Desktop (QWidget::find() 
returns NULL when I provide correct winId).
  Please give me advice.
        Petr.


Message 2 in thread

        Hello All.
  I have a problem. I'm writing a qt-based dictionary and I want to show it's 
window only when the user press the key-sequence (e.g. CTRL+ALT+T). So in any 
time before my appication don't have focus so can't use ordinary accelerator. 
  I think the right way to make this work is to put my own event-processing 
function (a hook) directly in X event queue. Doing so I could intercept _all_ 
key-press events and react them. Qt offers the way to do similar thing, there 
is installEventFilter function. It requires QWidget object which for it is 
called. But I can't get QWidget object even for KDE-Desktop (QWidget::find() 
returns NULL when I provide correct winId).
  Please give me advice.
        Petr.