[Qt-interest] QWidget: Must construct a QApplication before a QPaintDevice

Syam Krishnan syamcr at gmail.com
Tue Sep 6 03:19:52 CEST 2011


On 09/05/2011 08:32 PM, Thiago Macieira wrote:
> On Monday, 5 de September de 2011 09:59:59 Yifei Li wrote:
>> void main()
>> {
>>       QApplication app();
> This is something you just have to learn once:
>
> The above does not declare a variable of name "app", of type QApplication and
> call its default constructor. It declares a variable ot name "app", of the
> type of a function pointer, taking no arguments, and returning a QApplication.

Ahem.. A little bit of nitpick. That line actually declares a function 
and not a function pointer. 'app' becomes a function
that takes no arguments and returns a QApplication object. It's not a 
function pointer. For example, you cannot assign
anything to it.
If it were a function pointer, then the declaration would've been:
QApplication (*app)();

Isn't it so?



Syam




More information about the Qt-interest-old mailing list