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. Custom abstract class as a model in model/view architecture

Custom abstract class as a model in model/view architecture

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.7k 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.
  • S Offline
    S Offline
    shamisen
    wrote on last edited by
    #1

    Hello,
    In the most of the examples I saw about the use of the model/view architecture, there is a QList of
    some custom class as a member of the model, representing the data structure of the model.
    In my situation, this custom class is an abstract class and my data structure is
    a list of pointers to the instances of the abstract class.
    Since each instance will be a element of a derived class from the abstract class, the meaning
    of the 'rows' in the model will change depending on the instance.
    My question is if the model/view architecture is doable in this context or if it can lead to some
    pitfalls.

    Thanks in beforehand and sorry if I'm not very clear, I'm still a beginner in MVC architecture
    and English is not my motherlanguage.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      As long as you know how to determine a row, this should be doable.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        Besides needing to know what consitutes a row in your model, the items in your model also need to support some kind of interface that the model can use to query for the information it needs, like the string value or an icon or perhaps other relevant data.

        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