Reimplements the :meth:`QWidget.paintEvent` method.

        :param event: Event.
        :type event: QEvent

def paintEvent(self, event):
        """
        Reimplements the :meth:`QWidget.paintEvent` method.

        :param event: Event.
        :type event: QEvent
        """

        def __set_bold(state):
            """
            Sets the current painter font bold state.

            :return: Definiton success.
            :rtype: bool
            """

            font = painter.font()
            font.setBold(state)
            painter.setFont(font)
            return True

        painter = QPainter(self)
        painter.fillRect(event.rect(), self.__background_color)

        pen = QPen(QBrush(), self.__separator_width)
        pen.setColor(self.__separator_color)
        painter.setPen(pen)
        top_right_corner = event.rect().topRight()
        bottom_right_corner = event.rect().bottomRight()
        painter.drawLine(top_right_corner.x(), top_right_corner.y(), bottom_right_corner.x(), bottom_right_corner.y())
        painter.setPen(self.__color)

        viewport_height = self.__editor.viewport().height()
        metrics = QFontMetrics(self.__editor.document().defaultFont())
        current_block = self.__editor.document().findBlock(
            self.__editor.textCursor().position())

        block = self.__editor.firstVisibleBlock()
        block_number = block.blockNumber()
        painter.setFont(self.__editor.document().defaultFont())

        while block.isValid():
            block_number += 1
            position = self.__editor.blockBoundingGeometry(block).topLeft() + self.__editor.contentOffset()
            if position.y() > viewport_height:
                break

            if not block.isVisible():
                continue

            block == current_block and __set_bold(True) or __set_bold(False)
            painter.drawText(
                self.width() - metrics.width(foundations.strings.to_string(block_number)) - self.__margin / 3,
                round(position.y() + metrics.ascent() + metrics.descent() -
                      (self.__editor.blockBoundingRect(block).height() * 8.0 / 100)),
                foundations.strings.to_string(block_number))
            block = block.next()

        painter.end()
        QWidget.paintEvent(self, event)