Results 1 to 14 of 14

Thread: how to use >> operator serialize QValueList<T> to QDataStream?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    55
    Qt products
    Qt3
    Platforms
    Unix/X11
    Thanks
    13

    Unhappy how to use >> operator serialize QValueList<T> to QDataStream?

    Below is the related instruction in qt.


    QDataStream & operator<< ( QDataStream & s, const QValueList<T> & l )
    This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
    Writes a list, l, to the stream s. The type T stored in the list must implement the streaming operator.
    QDataStream & operator>> ( QDataStream & s, QValueList<T> & l )
    Reads a list, l, from the stream s. The type T stored in the list must implement the streaming operator.



    I have realize >> operator in my "T", as below:

    Qt Code:
    1. class CSysAlarm
    2. {
    3.  
    4. public:
    5. CSysAlarm(ENUM_INFO_TYPE infoType=COS_INFO);
    6. ~CSysAlarm();
    7. QDataStream& operator <<( QDataStream& stream );
    8. // Attributes
    9. public:
    10.  
    11. ENUM_INFO_TYPE m_enumInfoType;
    12. bool m_bIfAlarm;
    13. uint m_dwAlarmTimes;
    14. bool m_bAutoPrint;
    15. bool m_bIfPop;
    16. bool m_bIfLoop;
    17. bool m_bAllInfo;
    18. QString m_strPathFile;
    19.  
    20. public:
    21.  
    22. };
    To copy to clipboard, switch view to plain text mode 

    And other code:

    Qt Code:
    1. QFile file( "hmiset.bin" );
    2. if(file.open(IO_WriteOnly )==false)
    3. return;
    4. QDataStream stream( &file );
    To copy to clipboard, switch view to plain text mode 

    How can I do this as title? thanks!
    Last edited by wysota; 18th May 2006 at 10:27.

Similar Threads

  1. QDataStream >> QString
    By smalls in forum Qt Programming
    Replies: 2
    Last Post: 17th January 2006, 22:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.