janus
11th October 2008, 11:10
Hi,
i do not fully understand the concept of pointers. Maybe someone could help me to understand.
I have a printing function that is called several times. The data within the models that are shown in the centralWidgets tables are printed. Therefore I am doing a cast to get the proxymodels:
void MyApp::printDialog()
{
QStandardItemModel *printModel = new QStandardItemModel;
QSortFilterProxyModel *tmMain = qobject_cast<QSortFilterProxyModel *>(cw->mainTable()->model());
SortFilterProxyModel *tmDetail = qobject_cast<SortFilterProxyModel *>(cw->detailTable()->model());
....
}
I am processing the data and insert them into the printingModel. My question is: What happens to the pointers *tmMain and *tmDetail after they run out of scope? Are they deleted because they are local variables? Or do I need to set them to =0? Do I get a copy of the object from the cast or a pointer to the object ...? Sorry, many questions. Thx in advance.
i do not fully understand the concept of pointers. Maybe someone could help me to understand.
I have a printing function that is called several times. The data within the models that are shown in the centralWidgets tables are printed. Therefore I am doing a cast to get the proxymodels:
void MyApp::printDialog()
{
QStandardItemModel *printModel = new QStandardItemModel;
QSortFilterProxyModel *tmMain = qobject_cast<QSortFilterProxyModel *>(cw->mainTable()->model());
SortFilterProxyModel *tmDetail = qobject_cast<SortFilterProxyModel *>(cw->detailTable()->model());
....
}
I am processing the data and insert them into the printingModel. My question is: What happens to the pointers *tmMain and *tmDetail after they run out of scope? Are they deleted because they are local variables? Or do I need to set them to =0? Do I get a copy of the object from the cast or a pointer to the object ...? Sorry, many questions. Thx in advance.