Add new widget inside dock, remove old one if existent

def setWidget(self, widget, index=0, row=None,
                  col=0, rowspan=1, colspan=1):
        """
        Add new widget inside dock, remove old one if existent
        """
        if row is None:
            row = self.currentRow
        self.currentRow = max(row + 1, self.currentRow)
        if index > len(self.widgets) - 1:
            # add new widget
            self.widgets.append(widget)
        else:  # change existing widget
            self.layout.removeWidget(self.widgets[index])
            self.widgets[index] = widget
        self.layout.addWidget(widget, row, col, rowspan, colspan)
        self.raiseOverlay()