Dear All,

I am beginner in Qt, and wanna ask about programming style :

What's difference of :

QDialog xdialog(this);
QHBoxLayout myLayout ;
myLayout.addWidget(widget,0,0);
dialog.setLayout(myLayout); // error happened

with

QDialog xdialog(this);
QHBoxLayout *myLayout = new QHBoxLayout;
myLayout->addWidget(widget,0,0);
xdialog.setLayout(myLayout); // no error occurs


Why we use 1st script, it returns error ? How to fix it if we want to use 1st script too ?

Thanks