Fixes to tankqdialog & engine to allow created dialogs to clean up and be cleaned up correctly

#21126 - tankqdialog now emits a dialog_closed signal when closed or when the contained widget is closed.  The child widget is also detached from the dialog so even if the dialog isn't gc'd the widget can be.

Updated the engine Base class to release created dialogs when they are closed and re-structured the code to simplify customisation in derived engines.