cann`t find right function in QAbstractItemModel for recive current row index.
..........
ui->setupUi(this);
ui->listView->setModel(model);
.........
............
..........
{
int index = model-> //??????????
qDebug() << index;
}
..........
model = new QStringListModel(this);
ui->setupUi(this);
ui->listView->setModel(model);
ui->listView->setEditTriggers(QAbstractItemView::AnyKeyPressed);
.........
connect(ui->listView,SIGNAL(clicked(QModelIndex)),this,SLOT(itemchange(QModelIndex)));
............
..........
void MainWindow::itemchange(QModelIndex modelindex)
{
int index = model-> //??????????
qDebug() << index;
}
To copy to clipboard, switch view to plain text mode
Bookmarks