pratham_shah
20th May 2013, 14:05
Hi,
I have a custom QDialog (say "MyDialog") with a QTableWidget to display my data.
Now in MyDialog constructor I have the following code
MyDialog::MyDialog(QWidget *parent) : QDialog(parent)
{
QItemEditorFactory *myFactory = new QItemEditorFactory;
QItemEditorCreatorBase *myEditorCreator = new QStandardItemEditorCreator<MyItemEditor>();
myFactory->registerEditor(QVariant::String, myEditorCreator );
QItemEditorFactory::setDefaultFactory(myFactory);
setupTable();
}
I have 2 queries regarding the code.
Firstly Who is responsible for deleting myFactory ?
Secondly, what is the scope of myFactory and hence the editor MyItemEditor ?
In other words will a different QTableWidget in some other place also use this factory ?
I have a custom QDialog (say "MyDialog") with a QTableWidget to display my data.
Now in MyDialog constructor I have the following code
MyDialog::MyDialog(QWidget *parent) : QDialog(parent)
{
QItemEditorFactory *myFactory = new QItemEditorFactory;
QItemEditorCreatorBase *myEditorCreator = new QStandardItemEditorCreator<MyItemEditor>();
myFactory->registerEditor(QVariant::String, myEditorCreator );
QItemEditorFactory::setDefaultFactory(myFactory);
setupTable();
}
I have 2 queries regarding the code.
Firstly Who is responsible for deleting myFactory ?
Secondly, what is the scope of myFactory and hence the editor MyItemEditor ?
In other words will a different QTableWidget in some other place also use this factory ?