(self, font: QFont)
return width
Return item width for the font
Return item width for the font
Return item width for the font
def __width_for_font(self, font: QFont) -> float:
        """Return item width for the font"""
        key = font.key()
        if key in self.__widthCache:
            return self.__widthCache[key]
        fm = QFontMetrics(font)
        width = max((fm.horizontalAdvance(text) for text in self.__items),
                    default=0)
        self.__widthCache[key] = width
        return width
def __width_for_font ( self , font : QFont ) -> float : key = font . key ( ) if key in self . __widthCache : return self . __widthCache [ key ] fm = QFontMetrics ( font ) width = max ( ( fm . horizontalAdvance ( text ) for text in self . __items ) , default = 0 ) self . __widthCache [ key ] = width return width