Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

just curious know. My base class is Qobject. I derive another class from Qobject. can I use the Derive class object in stature?



  • class DataRestore : public QObject {
    Q_OBJECT
    };

    mainWindow. h file

    struct InstrumentHandler {
    	typedef struct 
    	{
    		RecoveryManage dataMange;
    		DataRestore *recoverChannelStore;
    	}RecoveryInfo;
    	
    	bool isItRecoverData = false;
    	RecoveryInfo recoverData;
    };
    

    can I create member as DataStore object instead of the pointer of the DataStore type?

    if no then, What is Reason behind that?
    note: Data store class is derive from Object.


  • Lifetime Qt Champion

    Hi,

    It depends whether you are going to copy your structure or not. If so, then no, you can't have your QObject based members as just plain members. See why here.



  • @SGaist Thank you sir.


Log in to reply