[英]Signal for Entire Row Selection in QTableWidget
Is there a signal for when an entire row in the QTableWidget has been selected by pressing the buttons that are stacked on the left? 是否有信号通过按下左侧堆叠的按钮选择QTableWidget中的整行? I would like that to enable some functionality, but am not sure how?
我想要启用一些功能,但不知道如何?
Thank you in advance! 先感谢您!
You have a couple of different options. 你有几个不同的选择。 The most direct for what you've asked is to use the QHeaderView that's associated with the buttons:
您所问的最直接的方法是使用与按钮关联的QHeaderView :
// you could also use verticalHeader()
connect(tableWidget->horizontalHeader(), SIGNAL(sectionClicked(int)), ...);
Another option is to listen to the selection model : 另一种选择是听取选择模型 :
connect(tableWidget->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), ...)
But, this option would require that you check the selection to see if only an entire row is selected, unless your SelectionMode prevents it from being otherwise. 但是,此选项要求您检查选择以查看是否只选择了整行,除非您的SelectionMode阻止其他行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.