QT控制tableWidget单选或多选

tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);  //设置为可以选中多个目标

 (参数含义:QAbstractItemView.NoSelection--不能选择

             QAbstractItemView.SingleSelection--选中单个目标

             QAbstractItemView.MultiSelection--选中多个目标

  QAbstractItemView.ExtendedSelection/QAbstractItemView.ContiguousSelection 的区别不明显,主要功能是正常情况下是单选,但按下Ctrl或Shift键后,可以多选)
发布了68 篇原创文章 · 获赞 34 · 访问量 19万+

猜你喜欢

转载自blog.csdn.net/yyj108317/article/details/102660516