Draws the grid on the inputed painter
        
        :param      painter     | <QPainter>
                    rect        | <QRect>
                    showGrid    | <bool>
                    showColumns | <bool>
                    showRows    | <bool>

def drawGrid(self, painter, rect, showGrid, showColumns, showRows):
        """
        Draws the grid on the inputed painter
        
        :param      painter     | <QPainter>
                    rect        | <QRect>
                    showGrid    | <bool>
                    showColumns | <bool>
                    showRows    | <bool>
        """
        if not (self.showGrid() and showGrid):
            return
        
        # saves the painter state before continuing
        painter.save()
        
        # draw the grid data
        painter.setBrush(self.alternateColor())
        painter.setPen(Qt.NoPen)
        
        # draw alternating rows
        if self.alternatingRowColors():
            painter.drawRects(self._buildData.get('grid_h_alt', []))
        
        # draw alternating columns
        if self.alternatingColumnColors():
            painter.drawRects(self._buildData.get('grid_v_alt', []))
        
        # draws the grid lines
        painter.setPen(QPen(self.axisColor()))
        grid = []
        if self.showRows() and showRows:
            grid += self._buildData.get('grid_h_lines', [])
        if self.showColumns() and showColumns:
            grid += self._buildData.get('grid_v_lines', [])
        
        if grid:
            painter.drawLines(grid)
        
        # restores the painter when finished
        painter.restore()