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. QListView - only one column visible even thought the model contains 3 columns
Forum Updated to NodeBB v4.3 + New Features

QListView - only one column visible even thought the model contains 3 columns

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

    I am adding entries to a QListView (QStandardItemModel items) in a loop as a read from a linked list:

    QStandardItem* item = new QStandardItem(getImagePath()),tr(text.toStdString().c_str()));
    standardModel->setItem(row, column, item);

    I need to be able to display things like

    1 2 3
    4 5 6
    7 8 9

    but what I get is

    1
    4
    7

    I have played with QListView setViewMode (IconMode and ListMode) and also setWrapping but the only way I can get the 3*3 grid effect is by putting all the items in column 1.

    Any clues please??

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      It is a QListView... it only shows a single column list (although you can select which column of the underlying model it displays). You want QTableView to be able to display more than one column.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Dolphin
        wrote on last edited by
        #3

        I thought that, my proposed ideas included a QTableView but I was shown a demo with it using a grid layout but I cannot repeat it, must have been smoke and mirrors - hard to question a task when it has been demonstrated to work, but I have no idea what he did, I'll get him when he is back in the office :-S

        So why does it allow me to add columns then, it the only the view accepting colums?

        HA HA!!! setFlow(QListView::LeftToRight);

        Yes!!

        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