[Qt-interest] Don't understand QWidget::QWidget(QWidget *parent, Qt::WindowFlags f) : QObject(*new QWidgetPrivate, 0)

Pritam Ghanghas pritam_ghanghas at infosys.com
Thu Jul 1 16:53:26 CEST 2010


scroll down in the code and you will find a protected ctr 
QObject(QObjectPrivate &dd, QObject *parent = 0);
and it demands a reference, so dereferencing the pointer.

-- 
Pritam


On Thu, 2010-07-01 at 19:10 +0530, Kustaa Nyholm wrote:
> This is going to expose my ignorance but I don't follow this
> from QWidget.cpp:
> 
> 
> In the constructor of QWidget
> 
> QWidget::QWidget(QWidget *parent, Qt::WindowFlags f) : QObject(*new
> QWidgetPrivate, 0)
> 
> Several things I don't understand here. QObject only has one constructor
> that takes one argument so how the base class QObject is initialized with
> two arguments? And why is parent not passed there? And why the derefenring
> of the new QWidgetPrivate?
> 
> Is this some C++ syntax mystery that I'm no awera of or what....?
> 
> br Kusti
>  
> 
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list