QModelIndex.column() error in QColumnView?
Hello.
I have pretty simple QColumnView and I have assigned to it simple model:
Code:
QColumnView *columnView = new QColumnView(this);
for (int i = 0; i < 4; ++i) {
parentItem->appendRow(item);
parentItem = item;
}
columnView->setModel(model);
But now when I for example use signal QColumnView::activated(const QModelIndex &index), the index.row() and index.column() is always 0, no matter on what item I click. And it's same also for other signals/functions. Is it a bug or am I doing something wrong? I just need to know, what item in QColumnView was activated.
Thank for help,
tlustoch
Re: QModelIndex.column() error in QColumnView?
Hmm, it is row 0 and column 0. Your model doesn't even have multiple columsn. The signal is exactly the same if you'd put the model to a QTreeView. Probably you need to check the parent to find out where the activated index is located.