'QObject::QObject' cannot access private member declared in class 'QObject'

前端 未结 5 528
天命终不由人
天命终不由人 2020-12-15 17:44
class CHIProjectData : public QObject
{
public:
    CHIProjectData();
    CHIProjectData(QMap aProjectData,
                   CHIAkmMetaData*         


        
5条回答
  •  伪装坚强ぢ
    2020-12-15 18:34

    When using QObject subclass objects try to manipulate with pointers.

    take the problematic scenario

    myObject = MyObjectClass() 
    

    in this case its more clean to have

    MyObjectClass *myObject;
    //code
    myObject = new MyObjectClass;
    

    This would remove the need for object copying and assignments by using reference copying and assignments.

提交回复
热议问题