'Set the widgets `expanded` state.'

def setExpanded(self, state):

    if (self.__expanded != state):
        self.__expanded = state
        if (state and (self.__expandedWidget is not None)):
            log.debug('Dock    expanding.')
            self.__stack.setCurrentWidget(self.__expandedWidget)
        elif ((not state) and (self.__collapsedWidget is not None)):
            log.debug('Dock    collapsing.')
            self.__stack.setCurrentWidget(self.__collapsedWidget)
        self.__fixIcon()
        self.expandedChanged.emit(state)
