diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-05-23 11:39:17 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:25 -0300 |
commit | 77559ac63945da93f7e90c2910232c6eb2629487 (patch) | |
tree | d5647375e1b48d7cef0d344433ddf9c578433829 /libpyside/destroylistener.h | |
parent | d9c43275a09fc68146a210a9da281a9491d62980 (diff) |
Created DestroyListener class.
This class is used to keep the Python object live until the signal destroyed emission.
With this is possible to use the QObject on destruction signal.
Fixes bug #505.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'libpyside/destroylistener.h')
-rw-r--r-- | libpyside/destroylistener.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libpyside/destroylistener.h b/libpyside/destroylistener.h new file mode 100644 index 000000000..54dda2c2e --- /dev/null +++ b/libpyside/destroylistener.h @@ -0,0 +1,32 @@ +#ifndef PYSIDE_DESTROY_LISTENER +#define PYSIDE_DESTROY_LISTENER + + +#include <QObject> +#include "pysidemacros.h" + +namespace PySide +{ +class DestroyListenerPrivate; +class PYSIDE_API DestroyListener : public QObject +{ + Q_OBJECT + public: + static DestroyListener* instance(); + static void destroy(); + void listen(QObject* obj); + + public slots: + void onObjectDestroyed(QObject* obj); + + private: + static DestroyListener* m_instance; + DestroyListenerPrivate* m_d; + DestroyListener(QObject *parent); + ~DestroyListener(); +}; + +}//namespace + +#endif + |