NonQObject* createObject(){ NonQObject* result = new NonQObject; try { functionThatCanThrowException(); // может сделать, throw std::runtime_error(), например } catch(....) { delete result; throw; } return result;}void foo(){ QScopedPointer<NonQObject> localObject = createObject(); // do something }
QList<QSharedPointer<NonQObject> >