code: def adjustTitleFont(self):
          
          left, top, right, bottom = self.contentsMargins()
          r = self.roundingRadius()
          
          # include text padding
          left += 5 + r / 2
          top += 5 + r / 2
          right += 5 + r / 2
          bottom += 5 + r / 2
          
          r = self.rect()
          rect_l = r.left() + left
          rect_r = r.right() - right
          rect_t = r.top() + top
          rect_b = r.bottom() - bottom
          
          # ensure we have a valid rect
          rect = QRect(rect_l, rect_t, rect_r - rect_l, rect_b - rect_t)
          if rect.width() < 10:
              return
          
          font = XFont(QApplication.font())
          font.adaptSize(self.displayName(), rect, wordWrap=self.wordWrap())
          
          self._titleFont = font
docs: Adjusts the font used for the title based on the current with and \
          display name.