我在使用tableWidget用了一个双击槽函数on_tableWidget_doubleClicked(QModelIndex index)
。会传递一个参数QModelIndex index,会在槽函数中判断是第几行,执行响应的操作,我现在的问题是我想在其他地方也触发这个槽函数,我就是不知道怎么给QModelIndex类型赋值,谢谢。
qt QModelIndex
------解决方案--------------------
自己想办法取:modelIndex。
------解决方案--------------------
QModelIndex QAbstractItemModel::createIndex(int row, int column, void * ptr = 0) const [protected]
Creates a model index for the given row and column with the internal pointer ptr.
When using a QSortFilterProxyModel, its indexes have their own internal pointer. It is not advisable to access this internal pointer outside of the model. Use the data() function instead.
This function provides a consistent interface that model subclasses must use to create model indexes.