How diff MousePress and shift/ctrl+MousePress?
-
QTable +model;
there is a request that if user click a item in first column,the whole row must be selected,but if user click other item( not belong first column),it only select a item.
so i implement the function like this
connect(tableview ,SIGNAL(clicked(const QModelIndex&)),this,SLOT(select_row(const QModelIndex&))); void MyWidget::select_row(const QModelIndex&){ if(index.column() ==0) tableview ->selectRow(index.row()); }
it worked,but there are some another request. The first ,user need shift+MousePressed to select more rows,I press "SHIFT" and the MousePress three item int first column(row 0,1,3),but four rows(0,1,2,3) are selected, i swear i never clicke QModelIndex(0,3)...
And another problem,when i select four rows(row index:0,1,2,3), then i hope "CTRL"+MousePressed third item to cancel the selection,but third row is always selected. I can't cancel selection by "CTRL"+MousePressed.
-
Q qazaq408 has marked this topic as solved