Hi Eric,

i have done the same thing a few times now (Parenting widgets under
inherited dockwidgets if the user wants them dockable and needing to clean
up stuff (QTimer etc.) ).

Maybe the reason that your closeEvent is not called when docked is, that
you are actually closing the DockWidget and not your QDialog and therefore
you are triggering the Dockwidgets closeEvent.
What you could do in this case would be to override the DockWidgets
closeEvent, and from in there
1. Also clean up or
2. call the child QDialog closeEvent that cleans up.

Also, you could override the instance factory method (__new__) of your
subclassed QDialog and search for instances of your custom QDialog type and
if some are found,
schedule them for deletion via deleteLater(). This way, you would make sure
that, before new instance creation, all old instances with timers etc. are
cleaned.

I often have a clean_up() method called within closeEvents and a
cleanup/deletion in __new__.

And it might be personal preference, but i would usually prefer to inherit
from default Qt types, such as QDockWidget instead of specialized Maya
types like maya.app.general.mayaMixin.MayaQWidgetDockableMixin if they
basically do the same......but maybe that just personal.

Cheers,
Timm

On Fri, Jan 23, 2015 at 8:33 PM, Marcus Ottosson <[email protected]>
wrote:

> It's possible that "closing" a docked window isn't the same as physically
> closing it via the X button on the Window; the latter potentially
> signalling via the Window Manager of the OS whereas the former is internal
> to Qt (i.e. deleting a widget).
>
> This might be related.
> http://qt-project.org/forums/viewthread/7661
>
> In which case it might be a parenting matter and you'll need to pass the
> DeleteOnClose bit.
> ​
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOACrhoQZF0KkbAD3mtoKbrV0-T4cjK%2BYCr9fDdxx_mY-w%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOACrhoQZF0KkbAD3mtoKbrV0-T4cjK%2BYCr9fDdxx_mY-w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Timm Wagener*
*Technical Artist / 3D Generalist*

*www.timmwagener.com <http://www.timmwagener.com>*

Email:
*[email protected] <[email protected]>*

Phone:
*0178-2810920*

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CA%2Bj65ipA2X4xX94YqfEHfnEJafr9nwABhZvNaRekN%2Bj-wiytAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to