I have a QListView which uses a model to load information to it. Bug when I insert new Rows into the model, it doesn’t show up in the QListView. These are the codes I used:
in header:
bugModel = new QStandardItemModel();
ui->bugList->setModel(bugModel);
in cpp (when button pressed):
bugModel->insertRows(bugModel->rowCount(), 1);
bugModel->setData(bugModel->index(bugModel->rowCount()-1,0), "Test");
What could be the problem?
P.S The function does get called when the button is pressed as I checked it using qDebug().
Did you add column?
If not – add line
bugModel->insertColumn(0);in header.