From the documentation for QCoreApplication::postEvent:
, . .
, std::shared_ptr , .
, std::unique_ptr ( std::make_unique), release , . , , , , . , , , - Good Thing ™.
auto evt = std::make_unique<MyCustomEvent>(arg1, arg2);
QCoreApplication::postEvent(targetObj, evt.release());
std::unique_ptr<MyCustomEvent> evt { new MyCustomEvent(arg1, arg2) };
QCoreApplication::postEvent(targetObj, evt.release());
QScopedPointer<MyCustomEvent> evt (new MyCustomEvent(arg1, arg2));
QCoreApplication::postEvent(targetObj, evt.take());