PDA

View Full Version : QListView current row index?



noborder
3rd February 2013, 18:06
cann`t find right function in QAbstractItemModel for recive current row 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(it emchange(QModelIndex)));
............
..........
void MainWindow::itemchange(QModelIndex modelindex)
{
int index = model-> //??????????
qDebug() << index;
}

Santosh Reddy
3rd February 2013, 18:21
You have to get it from QModelIndex (not from QAbstractItemModel)

int QModelIndex::row () const