Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem subclassing QIODevice
Forum Updated to NodeBB v4.3 + New Features

Problem subclassing QIODevice

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 283 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ocgltdO Offline
    ocgltdO Offline
    ocgltd
    wrote on last edited by
    #1

    I want to subclass QIODevice, so that I can implement a class which operates in Sequential mode (not random access).

    However, it appears that the Sequential property offers a getter (isSequential) but no setter. How can my subclass set Sequential mode?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      isSequential is virtual. You overload that method.

      There's no reason for a setter as devices usually can't change their type like that on the fly.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      ocgltdO 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        isSequential is virtual. You overload that method.

        There's no reason for a setter as devices usually can't change their type like that on the fly.

        ocgltdO Offline
        ocgltdO Offline
        ocgltd
        wrote on last edited by
        #3

        @SGaist I saw some (old) source from IODevice.cpp that showed isSequential checking bits/flags of mode. But another source showing it just returning false.

        So if I simply override the function to return true, there is nothing further I need to do/set?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You need to implement it to work sequentially and that should be it.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved