c++qtqscopedpointer

How to use QScopedPointer<QApplication>


I have an example that use

QApplication app(argc,argv);
QStandardItemModel* model = new QStandardItemModel(r,c,&app);

But in my program I have

QScopedPointer<QApplication> app(createApplication(argc, argv));
QStandardItemModel* model = new QStandardItemModel(r,c,&app); //ERROR: no matching function

How to use this QScopedPointer without error?


Solution

  • QScopedPointer<QApplication> app(createApplication(argc, argv));
    QStandardItemModel* model = new QStandardItemModel(r,c,app.data());