(self)
return size
Reimplemented.
Reimplemented.
Reimplemented .
def sizeHint(self):
        # type: () -> QSize
        """Reimplemented."""
        # Most of this is taken from QLineEdit's sources, the difference
        # is only in the use of minimumContentsLength instead of a
        # hardcoded constant.
        self.ensurePolished()
        fm = self.fontMetrics()
        textmargins = self.textMargins()
        contentsmargins = self.contentsMargins()

        h = (max(fm.height(), 14) + 2 * self._verticalMargin +
             textmargins.top() + textmargins.bottom() +
             contentsmargins.top() + contentsmargins.bottom())

        nchar = self.__minimumContentsLength
        if nchar <= 0:
            nchar = 17

        w = (fm.horizontalAdvance("X") * nchar + 2 * self._horizontalMargin +
             textmargins.left() + textmargins.right() +
             contentsmargins.left() + contentsmargins.right())

        opt = QStyleOptionFrame()
        self.initStyleOption(opt)
        size = self.style().sizeFromContents(
            QStyle.CT_LineEdit, opt, QSize(w, h), self
        )
        return size
def sizeHint ( self ) : # type: () -> QSize # Most of this is taken from QLineEdit's sources, the difference # is only in the use of minimumContentsLength instead of a # hardcoded constant. self . ensurePolished ( ) fm = self . fontMetrics ( ) textmargins = self . textMargins ( ) contentsmargins = self . contentsMargins ( ) h = ( max ( fm . height ( ) , 14 ) + 2 * self . _verticalMargin + textmargins . top ( ) + textmargins . bottom ( ) + contentsmargins . top ( ) + contentsmargins . bottom ( ) ) nchar = self . __minimumContentsLength if nchar <= 0 : nchar = 17 w = ( fm . horizontalAdvance ( "X" ) * nchar + 2 * self . _horizontalMargin + textmargins . left ( ) + textmargins . right ( ) + contentsmargins . left ( ) + contentsmargins . right ( ) ) opt = QStyleOptionFrame ( ) self . initStyleOption ( opt ) size = self . style ( ) . sizeFromContents ( QStyle . CT_LineEdit , opt , QSize ( w , h ) , self ) return size