[Qt-interest] How expensive registering a new (custom) event is?

Girish Ramakrishnan girish at forwardbias.in
Thu Oct 15 14:17:44 CEST 2009


Mihail Naydenov wrote:
> Im looking for advise, should I use as many custom events as I need, or, for example, just one and invent my one "sub-type" (through private enum) of that event.
> I imagine registering a new event has some toll on the hole program, but is it noticeable? 
> Should I care to limit the num of new events I create and register?
> (For now I'm not interested in filtering them)
> 

Use as many as you like. See QEvent::User and QEvent::MaxUser for how
many you can define. There is no noticeable advantage or expense over
using a 'sub-type'. Also, use QEvent::registerEventType instead of
(static) enum values.

Girish



More information about the Qt-interest-old mailing list