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. deriving abstract classes from qt concrete classes
Forum Update on Monday, May 27th 2025

deriving abstract classes from qt concrete classes

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 552 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.
  • U Offline
    U Offline
    user4592357
    wrote on last edited by
    #1

    i need to define interfaces for the application. these interfaces must work with widgets such as tree view, table view, etc. i wanna know how logical it is to derive classes from qt concrete classes (e.g. QTreeView) and make that class abstract?

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

      Hi,

      What exact interface do you want to add ?
      Can you explain the context for creating such an abstract class ?

      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
      2
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #3

        Hi
        I think you have to explain in more detail the requirements as
        QTreeView already derive from the abstract class
        QAbstractItemView
        https://doc.qt.io/qt-5/qabstractitemview.html
        So it would seem odd to abstract the concrete class implementation. (imo) :)

        update: too slow ;)

        1 Reply Last reply
        2
        • U Offline
          U Offline
          user4592357
          wrote on last edited by
          #4

          i need, for example, a populate() method which will populate the top level of the tree.

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

            Then the question is: is it a class that you will provide through a library ?

            In any case, nothing stops you from creating an abstract subclass with that method as pure virtual.

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

            U 1 Reply Last reply
            0
            • SGaistS SGaist

              Then the question is: is it a class that you will provide through a library ?

              In any case, nothing stops you from creating an abstract subclass with that method as pure virtual.

              U Offline
              U Offline
              user4592357
              wrote on last edited by
              #6

              @sgaist
              yeah it is going to be some kind of library, and that's why i need to make the abstractions...

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

                Then, as the logo says: Just do 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
                2

                • Login

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