'Restore the toolbox from a :class:`QByteArray` `state`.
.. note:: The toolbox should already be populated for the state
changes to take effect.'

def restoreState(self, state):

    if isinstance(state, QByteArray):
        stream = QDataStream(state, QIODevice.ReadOnly)
        version = stream.readInt()
        if (version == 2):
            expanded = stream.readQStringList()
            for action in map(self.tabAction, range(self.count())):
                if ((action.text() in expanded) != action.isChecked()):
                    action.trigger()
            return True
    return False
