Overloading the QDataStream << and>> operators for a user-defined type

前端 未结 2 538
慢半拍i
慢半拍i 2020-12-11 05:52

I have a an object I\'d like to be able to read and write to/from a QDataStream. The header is as follows:

class Compound
{
public:
    Compound(QString, QPi         


        
2条回答
  •  不知归路
    2020-12-11 06:01

    If you want to overload the "extract" operator >>, your signature must be:

    QDataStream & operator >> (QDataStream & in, MyClass & class);
    

    Hope it helps.

提交回复
热议问题