Results 1 to 2 of 2

Thread: How to properly subclass QIODevice -- understanding the docs

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to properly subclass QIODevice -- understanding the docs

    QIODevice keeps a track of the number of bytes read (i.e. the pos()) and allows you to skip about with seek(). If your subclass implements a seek() override that does something special, or some other function that affects the current position, it should call QIODevice::seek() so the base class is updated properly. That is:
    Qt Code:
    1. bool MyIODevice::seek ( qint64 pos ) {
    2. QIODevice::seek(pos);
    3. // Do your sub-class magic with pos here
    4. // e.g. if you need to issue commands to hardware to rewind to the corresponding position
    5. }
    To copy to clipboard, switch view to plain text mode 
    If you do not override the base class seek() then you don't need to do anything special.

  2. The following user says thank you to ChrisW67 for this useful post:

    hackerNovitiate (2nd January 2012)

Similar Threads

  1. QHelpCollection xml docs
    By johnmauer in forum Newbie
    Replies: 0
    Last Post: 17th December 2010, 18:01
  2. template to retrieve QIODevice subclass
    By onil in forum Qt Programming
    Replies: 6
    Last Post: 25th June 2010, 16:54
  3. Replies: 0
    Last Post: 28th October 2009, 11:20
  4. doxygen config like qt docs
    By danadam in forum General Discussion
    Replies: 1
    Last Post: 3rd September 2006, 18:10
  5. Problem with the Qt docs
    By Morea in forum Qt Programming
    Replies: 6
    Last Post: 21st February 2006, 12:11

Tags for this Thread

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.