PyQt: RuntimeError: wrapped C/C++ object has been deleted

This answer to this question is as found here: Python PySide (Internal c++ Object Already Deleted) Apparently, assigning one widget to QMainWindow using setCentralWidget and then assigning another widget with setCentralWidget will cause the underlying c++ QWidget to be deleted, even though I have an object that maintains reference to it. Note: QMainWindow takes ownership … Read more

How do I copy object in Qt?

It seems the copy constructor and assignment operator are disabled. From this. No copy constructor or assignment operator QObject has neither a copy constructor nor an assignment operator. This is by design. Actually, they are declared, but in a private section with the macro Q_DISABLE_COPY(). In fact, all Qt classes derived from QObject (direct or … Read more

When should Q_OBJECT be used?

You should use the Q_OBJECT macro for any non-templated classes that derive from QObject. Besides signals and slots, the Q_OBJECT macro provides the meta object information that is associated with given class. As stated in the documentation: we strongly recommend that all subclasses of QObject use the Q_OBJECT macro regardless of whether or not they … Read more