'Set a model (`QStandardItemModel`) for the tool grid. The
widget actions are children of the rootIndex.
.. warning:: The model should not be deleted before the
`WidgetToolGrid` instance.'

def setModel(self, model, rootIndex=QModelIndex()):

    if (self.__model is not None):
        self.__model.rowsInserted.disconnect(self.__on_rowsInserted)
        self.__model.rowsRemoved.disconnect(self.__on_rowsRemoved)
        self.__model = None
    self.__model = model
    self.__rootIndex = rootIndex
    if (self.__model is not None):
        self.__model.rowsInserted.connect(self.__on_rowsInserted)
        self.__model.rowsRemoved.connect(self.__on_rowsRemoved)
    self.__initFromModel(model, rootIndex)
