[Qt-interest] System-wide shortcut (hotkey)

Anthony Serdyukov uksus70 at gmail.com
Mon Jan 19 03:55:23 CET 2009


The documentation i have cited says "install event filter". So, I
thought they mean QObject::installEventFilter() method.
But Matt has pointed out another method
QAbstractEventDispatcher::setEventFilter, whic is specific to
QAbstractEventDispatcher.
So, what is the difference between theses two event filters besides
signatures and OO/functional styles? i.e. what events are filtered by
which filter?

And what kind of filtering is the cited documentation talking about?

P.S.
Matt, I haven't understood your notice about mailing list. What is wrong?

2009/1/18 Matt Rogers <mattr at kde.org>:
> On Tuesday 13 January 2009 01:20:45 Anthony Serdyukov wrote:
>> Thanks, I'm looking at QAbstractEventDispatcher too, and that is why.
>>
>> In the documentation for QCoreApplication::winEventFilter I have found
>> the following:
>>
>> <cite>
>> It is only directly addressed messages that are filtered. To handle
>> system wide messages, such as messages from a registered hot key, you
>> need to install an event filter on the event dispatcher, which is
>> returned from QAbstractEventDispatcher::instance().
>> </cite>
>>
>> So, what kind of hot keys are mentioned here... don't know. And how to
>> register it properly?
>>
>
> First, don't top post, especially to mailing lists and newsgroups. Makes
> following a thread nearly impossible (and it's bad netiquette to boot).
>
> So, installing an event filter on the event dispatcher is as simple as the
> following snippet:
>
> QAbstractEventDIspatcher* ed = QAbstractEventDispatcher::instance();
> QAbstractEventDispatcher::EventFilter ef = &eventFilterFunction;
> ed->setEventFilter(ef);
>
> eventFilterFunction is implemented by you to catch the events you want at the
> system level.
>
> Hope this helps,
> Matt
>
>> 2009/1/13 R. Reucher <rene.reucher at batcom-it.net>:
>> > On Tue January 13 2009 06:48:15 Anthony Serdyukov wrote:
>> >> Good day.
>> >>
>> >> I need to set system-wide hotkey and perform some action when it is
>> >> fired. The only one discussion I have found is here:
>> >> http://lists.trolltech.com/qt-interest/2007-07/thread00221-0.html
>> >> But unfortunately, there is no solution there.
>> >>
>> >> Qt 4.4.3, platform is Windows.
>> >
>> > As far as I can tell, QAction doesn't support that natively - the
>> > highest "level" of the shortcut context is on application level.
>> >
>> > The only solution I can think of is to use QAbstractEventDispatcher and
>> > install an event filter function that does the job... but I've never
>> > tried it, so I can't tell if what you are aiming to achieve is really
>> > possible this way.
>> >
>> > There may also be platform dependent ways, of course...
>> >
>> > HTH, René
>> > --
>> > René Reucher
>> > rene.reucher at batcom-it.net
>> > http://www.batcom-it.net/
>> >
>> > "Biology is the only science in which multiplication means the same
>> > thing as division."
>> >
>> > _______________________________________________
>> > Qt-interest mailing list
>> > Qt-interest at trolltech.com
>> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> --
> Matt
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>



-- 
Regards,
Anthony




More information about the Qt-interest-old mailing list