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 Update on Monday, May 27th 2025

Problem subclassing QIODevice

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 257 Views
  • 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.
  • O Offline
    O Offline
    ocgltd
    wrote on 9 Aug 2022, 19:27 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 9 Aug 2022, 19:34 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

      O 1 Reply Last reply 9 Aug 2022, 20:15
      1
      • S SGaist
        9 Aug 2022, 19:34

        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.

        O Offline
        O Offline
        ocgltd
        wrote on 9 Aug 2022, 20:15 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
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 10 Aug 2022, 19:57 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

          1/4

          9 Aug 2022, 19:27

          • Login

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