code: def paintEvent(self, event):
          
          painter = QPainter(self)
  
          color = QColor(self.color)
          color.setAlphaF(.5)
          painter.setPen(color)
          offset = self.editor.document().documentMargin() + \
              self.editor.contentOffset().x()
  
          for _, line_number, block in self.editor.visible_blocks:
  
              indentation = TextBlockHelper.get_fold_lvl(block)
              ref_lvl = indentation
              block = block.next()
              last_line = block.blockNumber()
              lvl = TextBlockHelper.get_fold_lvl(block)
              if ref_lvl == lvl:  # for zone set programmatically such as imports
                  # in pyqode.python
                  ref_lvl -= 1
  
              while (block.isValid() and
                     TextBlockHelper.get_fold_lvl(block) > ref_lvl):
                  last_line = block.blockNumber()
                  block = block.next()
  
              end_of_sub_fold = block
              if last_line:
                  block = block.document().findBlockByNumber(last_line)
                  while ((block.blockNumber()) and (block.text().strip() == ''
                         or block.text().strip().startswith('#'))):
                      block = block.previous()
                      last_line = block.blockNumber()
  
              block = self.editor.document().findBlockByNumber(line_number)
              top = int(self.editor.blockBoundingGeometry(block).translated(
                  self.editor.contentOffset()).top())
              bottom = top + int(self.editor.blockBoundingRect(block).height())
  
              indentation = TextBlockHelper.get_fold_lvl(block)
  
              for i in range(1, indentation):
                  if (line_number > last_line and
                          TextBlockHelper.get_fold_lvl(end_of_sub_fold) <= i):
                      continue
                  else:
                      x = self.editor.fontMetrics().width(i * self.i_width *
                                                          '9') + offset
                      painter.drawLine(x, top, x, bottom)
docs: Override Qt method.