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

Qt-jambi-interest Archive, October 2007
Catching global keyboard events


Message 1 in thread

Hi,

Is it possible to catch global keyboard events and consume them before they 
are processed in the menu system ? Somewhere and sometimes in our 
application we need to process the ALT-F event even if it's mapped to the 
File menu...

-=Børge 


Message 2 in thread

Børge Austvold wrote:
> Hi,
> 
> Is it possible to catch global keyboard events and consume them before 
> they are processed in the menu system ? Somewhere and sometimes in our 
> application we need to process the ALT-F event even if it's mapped to 
> the File menu...
> 
> -=Børge

Hi Børge,

You should be able to acheive this by setting the shortcuts context to 
to ApplicationContext:

http://doc.trolltech.com/qtjambi-4.3.1_01/com/trolltech/qt/gui/QShortcut.html#setContext(com.trolltech.qt.core.Qt.ShortcutContext)

and

http://doc.trolltech.com/qtjambi-4.3.1_01/com/trolltech/qt/core/Qt.ShortcutContext.html#ApplicationShortcut

best regards,
Gunnar


Message 3 in thread

Hi Gunnar,

Can you give some examples of how a QGraphicsItem in a scene can process and 
consume events like TAB/Shift-TAB before they are procesed my jambi ?

-=Børge


"Gunnar Sletta" <gunnar@xxxxxxxxxxxxx> wrote in message 
news:4700B640.1010308@xxxxxxxxxxxxxxxx
> Børge Austvold wrote:
>> Hi,
>>
>> Is it possible to catch global keyboard events and consume them before 
>> they are processed in the menu system ? Somewhere and sometimes in our 
>> application we need to process the ALT-F event even if it's mapped to the 
>> File menu...
>>
>> -=Børge
>
> Hi Børge,
>
> You should be able to acheive this by setting the shortcuts context to to 
> ApplicationContext:
>
> http://doc.trolltech.com/qtjambi-4.3.1_01/com/trolltech/qt/gui/QShortcut.html#setContext(com.trolltech.qt.core.Qt.ShortcutContext)
>
> and
>
> http://doc.trolltech.com/qtjambi-4.3.1_01/com/trolltech/qt/core/Qt.ShortcutContext.html#ApplicationShortcut
>
> best regards,
> Gunnar 


Message 4 in thread

Børge Austvold wrote:
> Hi Gunnar,
> 
> Can you give some examples of how a QGraphicsItem in a scene can process 
> and consume events like TAB/Shift-TAB before they are procesed my jambi ?
> 
> -=Børge

Hi Børge,

You consume an event by calling accept() on it.

-
Gunnar