Skip to content Skip to sidebar Skip to footer

How To Get Rid Of The Blank Area At The Bottom Of Tableview

There's always an bland area at the bottom of the tableview of QTableWidget. How can I get rid of this blank area, and let the tableview only display the row and column according

Solution 1:

You have to set Stretch as resizeMode to the verticalheader():

import sys
from PyQt5 import QtWidgets, QtCore, QtGui

if__name__== '__main__':
    app = QtWidgets.QApplication(sys.argv)
    w = QtWidgets.QTableView()
    w.setModel(QtGui.QStandardItemModel(4, 4))
    w.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
    w.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
    w.show()
    sys.exit(app.exec_())

enter image description here

Post a Comment for "How To Get Rid Of The Blank Area At The Bottom Of Tableview"