PyQt5 Horizontal Scrollbar in QTableWidget not appearing

亡梦爱人 提交于 2019-12-02 23:02:49

问题


I have a QTableWidget displaying times for each bus stop from a database, however for some reason in the table, the horizontal scrollbar doesn't appear. I can only scroll by dragging off the table

I have already tried setting its policy to always on but it doesn't seem to work

 # Route search table display settings
  self.route_search_table = QtWidgets.QTableWidget(self.route_search_frame)
  self.route_search_table.setGeometry(QtCore.QRect(20, 180, 371, 251))
  self.route_search_table.setStyleSheet("background-color: rgb(255, 255, 255)")
  self.route_search_table.setObjectName("route_search_table")
  self.route_search_table.horizontalHeader().setVisible(False)
  self.route_search_table.verticalHeader().setVisible(False)     
  self.route_search_table.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
  self.route_search_table.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)                                                 

来源:https://stackoverflow.com/questions/56609833/pyqt5-horizontal-scrollbar-in-qtablewidget-not-appearing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!