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. How to use QAbstractListModel with QTableView?

How to use QAbstractListModel with QTableView?

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

    Hello all!

    I have a class which inherits QAbstractListModel. On the other hand I have a QTableView to display the data, but when I set the model it shows the items vertically aligned, is it possible to set it as rows?
    rows should have the 5 items width for example and how can I do it?
    So I want ListModel to be used to represent the view as a table

    thank you

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Subst27
      wrote on last edited by
      #2

      Hi!

      I'm afraid no.

      The QAbstractListModel class provides an abstract model that can be subclassed to create one-dimensional list models

      try to use QAbstractItemModel

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

        I'd try QAbstractTableModel instead. It is easier to work with than a raw QAbstractItemModel if you don't need the nesting aspects (to build a tree, for instance).

        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