Adjusts the size of this node to support the length of its contents.

def adjustSize( self ):
        """
        Adjusts the size of this node to support the length of its contents.
        """
        cell      = self.scene().cellWidth() * 2
        minheight = cell
        minwidth  = 2 * cell
        
        # fit to the grid size
        metrics = QFontMetrics(QApplication.font())
        width   = metrics.width(self.displayName()) + 20
        width   = ((width/cell) * cell) + (cell % width)
        
        height  = self.rect().height()
        
        # adjust for the icon
        icon = self.icon()
        if icon and not icon.isNull():
            width += self.iconSize().width() + 2
            height = max(height, self.iconSize().height() + 2)
        
        w = max(width, minwidth)
        h = max(height, minheight)
        
        max_w = self.maximumWidth()
        max_h = self.maximumHeight()
        
        if max_w is not None:
            w = min(w, max_w)
        if max_h is not None:
            h = min(h, max_h)
        
        self.setMinimumWidth(w)
        self.setMinimumHeight(h)
        
        self.rebuild()