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

  • 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


    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??

  • 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.

  • 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);


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.