Qt 多信号顺序问题:
5.4在Qt的xchat频道看到的提问:
xVim:
Hi. I have a QTableWidget and delete a selected row from it. Therefore, the itemSelectionChanged signal is triggered, which is connected to my slot s. Why does QTableWidget.rowCount() inside that custom slot s give the wrong number of table entries (the number before the deletion)?
Someone else on stackoverflow has the same (unresolved) problem with a QListWidget: https://stackoverflow.com/q/10682621
I am not sure whether I should file a bug for the wrong result of the rowCount() call - I somehow doubt that it is a bug. But I cannot explain why it gives the wrong value in my code. And other people seem to get the same wrong result.
大意是xVim为QTableWidget的itemSelectionChanged连接了一个自定义的槽,结果清空表格时 与itemSelectionChanged连接的槽调用rowCount()得到的却是清空前的行数。而StackOverflow 中这位 https://stackoverflow.com/q/10682621 也遇到同样问题。
模拟之:
ListWidgetTest.ui:一个带两个默认名称pushB