|
QStandardItemModel*model=new QStandardItemModel(7,4,this);
......
QModelIndex topLeft;
QModelIndex bottomRight;
topLeft=model->index(1,1,QModelIndex());
bottomRight=model->index(5,2,QModelIndex());
QItemSelection selection(topLeft,bottomRight);
问题一:为什么这么设置后启动程序,currentIndex()函数返回的是(0,0)的数据项,(0,0)不是没有选择到selection中吗?
问题二:运行程序时,选择比如先选择(1,1)的item,然后按住shift点击(3,3)这时(3,3)是当前item,(1,1)到(3,3)之间的项目会被选择,但是如果再按(2,2)此时是(1,1)和(2,2)之间的被选择而为什么不是(2,2)和(3,3)之间的项目被选择呢?不是说selectionMode为contiguousSelection时是单击项目和当前项目之间的被选择,那(3,3)在单击前不就是当前项目吗?
跪求大神解答 |
|