QModelIndex index = model->index(row, column, parentIndex); int id = index.internalId();
model->setData(index, QVariant::fromValue(42), Qt::UserRole); index.internalId() = 100;In this example, we set some data in the model using the setData() function, and also set the internalId of the index to 100. These examples use the Qt package library, as the QModelIndex class is part of the Qt framework.