I have spent the last week struggling to create a QModelIndex given a row and a column.
Alternatively, I would settle for changing the value of row() in an already existing QModelIndex.
Any help would be appreciated.
Edit:
QModelIndex nIndex = QAbstractItemModel::createIndex(1, 2);
int b = nIndex.row();
qInfo() << "b" << b;
Fails with error:
cannot call member function ‘QModelIndex QAbstractItemModel::createIndex(int, int, void*) const’ without object
QModelIndex nIndex = QAbstractItemModel::createIndex(1, 2);
^
The goal at hand is this:
I have a function:
void MyClass::doStuff(QModelIndex index)
Inside that class, I essentially do the following:
if (index.column() != 1)
{
int a=index.row();
}
So my goal is to call that function from a different class and pass it a QModelIndex, but for that index to have been created with a row/column I specify.