I understand why I get a C2248: \'QObject::QObject\' : cannot access private member declared in class \'QObject\'
. Qt objects are not copyable, as explained here:<
The easiest solution to detect the root cause is by making your copy ctor also private. (Or deleted, but that's not possible in VS2010 yet). This will suppress the automatically-generated copy ctor, which was the source of the error.
If you are not explicitly copying your MyObject
but you keep getting this error message then something you're using in conjunction with your MyObject
is doing the copying on your behalf.
The most likely culprit would be one of the container classes, e.g. QList
, QVector
, etc.
Read the Container class documentation for more information as well as the specific class' documentation of any container you might be using. All containers have requirements of their elements, e.g. Must have default constructor, must be assignable, etc. This is where I think your problem lies.