QListWidget的currentRow属性保存当前项的位置,为整型,从0开始计数,在某些选择模式下,当前项可能也是选中项。
currentRow属性可以通过方法currentRow()、setCurrentRow(int row)、setCurrentRow(int row, QItemSelectionModel.SelectionFlags command)进行访问和设置。
关于QItemSelectionModel.SelectionFlags的取值请参考《PyQt(Python+Qt)学习随笔:Mode/View中的枚举类 QItemSelectionModel.SelectionFlag取值及含义》。
当当前项发生变化时,QListWidget会发射信号
currentRowChanged(int currentRow)。
本文详细介绍了QListWidget中的currentRow属性,包括其功能、如何通过currentRow()等方法获取和设置当前项位置,以及与QItemSelectionModel.SelectionFlags的关系。同时,文章还提到了currentRow变化时触发的信号currentRowChanged(int currentRow)。
384

被折叠的 条评论
为什么被折叠?



