I\'m using Qt and have some real basic problems. I have created my own widget MyTest that have a variable obj
. I need to set this variable obj
from
Aaron is correct about using the assignment operator.
The only way that I'm aware of to make a copy of an object, if you really have to, is to use Serialization as described in QDataStream Class. This would make a deep copy of the object.
Or have you considered wrapping the class as a QSharedPointer pointer that you can safely pass around. This would be a shadow or reference copy of the object though.