python - pyqt的tablewidget,现在想实现一个快速定位到某一行并显示的功能
PHP中文网
PHP中文网 2017-04-18 10:16:27
0
2
993

因为现在用pyqt来显示tablewidget表格的行数很多,用鼠标滚轮要很久,想做一个输入行号就直接定位过去并显示,比如输入9999,就直接显示第9999行,相当于鼠标滚轮到了第9999行。
查了一下qt的官方手册,貌似没有类似的接口?

PHP中文网
PHP中文网

认证0级讲师

reply all(2)
洪涛
item=self.tableWidget.findItems(text, QtCore.Qt.MatchExactly)#遍历表查找对应的item
row=item[0].row()                                            #获取其行号
self.tableWidget.verticalScrollBar().setSliderPosition(row)  #滚轮定位过去,搞定
小葫芦

It is not recommended to display too much data. You can change the idea and paginate the table. Line 9999 can be displayed directly to the page. This way the table takes up less memory and is easy to view

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!