code: def adjustTextMargins( self ):
          
          left_buttons = self._buttons.get(Qt.AlignLeft, [])
          
          if left_buttons:
              bwidth = left_buttons[-1].pos().x() + left_buttons[-1].width() - 4
          else:
              bwidth = 0 + (max(8, self.cornerRadius()) - 8)
          
          ico = self.icon()
          if ico and not ico.isNull():
              bwidth += self.iconSize().width()
          
          self.setTextMargins(bwidth, 0, 0, 0)
docs: Adjusts the margins for the text based on the contents to be displayed.