(self, column)
return width + 1 if self.showGrid() else width
Reimplemented from `QTableView.sizeHintForColumn`

        Note: This does not match the QTableView's implementation,
        in particular size hints from editor/index widgets are not taken
        into account.

        Parameters
        ----------
        column : int
Reimplemented from `QTableView.sizeHintForColumn`
Reimplemented from QTableView . sizeHintForColumn
def sizeHintForColumn(self, column):
        """
        Reimplemented from `QTableView.sizeHintForColumn`

        Note: This does not match the QTableView's implementation,
        in particular size hints from editor/index widgets are not taken
        into account.

        Parameters
        ----------
        column : int
        """
        # This is probably not needed in Qt5?
        if self.model() is None:
            return -1

        self.ensurePolished()
        model = self.model()
        vheader = self.verticalHeader()
        top = vheader.visualIndexAt(0)
        bottom = vheader.visualIndexAt(self.viewport().height())
        if bottom < 0:
            bottom = self.model().rowCount()

        options = self.viewOptions()
        options.widget = self

        width = 0
        sample_count = 0

        for row in range(top, bottom):
            if not vheader.isSectionHidden(vheader.logicalIndex(row)):
                index = model.index(row, column)
                delegate = self.itemDelegate(index)
                if not delegate:
                    continue
                size = delegate.sizeHint(options, index)
                width = max(size.width(), width)
                sample_count += 1

            if sample_count >= TableView.MaxSizeHintSamples:
                break

        return width + 1 if self.showGrid() else width
def sizeHintForColumn ( self , column ) : # This is probably not needed in Qt5? if self . model ( ) is None : return - 1 self . ensurePolished ( ) model = self . model ( ) vheader = self . verticalHeader ( ) top = vheader . visualIndexAt ( 0 ) bottom = vheader . visualIndexAt ( self . viewport ( ) . height ( ) ) if bottom < 0 : bottom = self . model ( ) . rowCount ( ) options = self . viewOptions ( ) options . widget = self width = 0 sample_count = 0 for row in range ( top , bottom ) : if not vheader . isSectionHidden ( vheader . logicalIndex ( row ) ) : index = model . index ( row , column ) delegate = self . itemDelegate ( index ) if not delegate : continue size = delegate . sizeHint ( options , index ) width = max ( size . width ( ) , width ) sample_count += 1 if sample_count >= TableView . MaxSizeHintSamples : break return width + 1 if self . showGrid ( ) else width