[SOLVED] Testing QAbstractItemModel::data
-
Hello,
I'm working on a model / view software, and so have a couple of QxxxModel.
I manage my unitary tests with the QTest library.I want to test my QxxxModel::data() methods on my unitary tests.
I perhaps miss something, but is there a way to construct QModelIndex with specific row / column for testing purpose?
Thanks!
-
Sure. Call the index() function. It takes a row, a column and a parent index. Pass an invalid QModelIndex (a default constructed one) as the parent to retreive a toplevel item.
-
Perfect, I missed this index()... Thanks!