[Interest] qApp macro equivalent for QApplication subclasses

Andrej Kacian andrej at kacian.sk
Fri Mar 21 11:22:19 CET 2014


On Fri, 21 Mar 2014 10:55:10 +0100
André Somers <andre at familiesomers.nl> wrote:

> Constantin Makshin schreef op 21-3-2014 04:46:
> > I don't see anything bad even in redefining the "qApp" macro itself
> > (inclusion guards in Qt headers will protect your redefinition from
> > being reverted) instead of inventing your "myApp" one.  
> I think it may be confusing to do so. The meaning of qApp will be 
> different depending on what includes you did in the file you call it 
> from (or recursively in the other files you have included). I don't 
> think that that is very good API, and prefer to make my own myApp
> define instead. Then, it is always clear what will be returned.

I was just about to reply in a similar fashion. :) There is no inherent
advantage in redefining the qApp macro, and using myApp just seems to
make for a better readable code, in my opinion.

Anyway, thanks both of you for your replies.

Regards,
-- 
Andrej



More information about the Interest mailing list