code: def make_flag_qrect(self, value):
          
          if self.slider:
              position = self.value_to_position(value+0.5)
              # The 0.5 offset is used to align the flags with the center of
              # their corresponding text edit block before scaling.
  
              return QRect(self.FLAGS_DX/2, position-self.FLAGS_DY/2,
                           self.WIDTH-self.FLAGS_DX, self.FLAGS_DY)
          else:
              # When the vertical scrollbar is not visible, the flags are
              # vertically aligned with the center of their corresponding
              # text block with no scaling.
              block = self.editor.document().findBlockByLineNumber(value)
              top = self.editor.blockBoundingGeometry(block).translated(
                        self.editor.contentOffset()).top()
              bottom = top + self.editor.blockBoundingRect(block).height()
              middle = (top + bottom)/2
  
              return QRect(self.FLAGS_DX/2, middle-self.FLAGS_DY/2,
                           self.WIDTH-self.FLAGS_DX, self.FLAGS_DY)
docs: Make flag QRect