def restoreXml(self, xml):
        """
        Restores properties for this tree widget from the inputed XML.
        
        :param      xml | <xml.etree.ElementTree.Element>
        
        :return     <bool> success
        """
        if xml is None:
            return False
        
        self.setUpdatesEnabled(False)
        self.blockSignals(True)
        
        # restore column data
        header = self.header()
        xcolumns = xml.find('columns')
        if xcolumns is not None:
            for xcolumn in xcolumns:
                name   = xcolumn.get('name')
                index  = self.column(name)
                vindex = int(xcolumn.get('visualIndex', index))
                currvi = header.visualIndex(index)
                
                # restore from name
                if index == -1:
                    continue
                
                if currvi != vindex:
                    header.moveSection(currvi, vindex)
                
                self.setColumnHidden(index, xcolumn.get('hidden') == 'True')
                
                if not self.isColumnHidden(index):
                    width  = int(xcolumn.get('width', self.columnWidth(index)))
                    self.setColumnWidth(index, width)
        
        # restore order data
        headerState = xml.get('headerState')
        if headerState is not None:
            state = QtCore.QByteArray.fromBase64(str(headerState))
            self.header().restoreState(state)
        
        sortColumn = int(xml.get('sortColumn', 0))
        sortingEnabled = xml.get('sortingEnabled') == 'True'
        sortOrder = QtCore.Qt.SortOrder(int(xml.get('sortOrder', 0)))
        
        if sortingEnabled:
            self.setSortingEnabled(sortingEnabled)
            self.sortByColumn(sortColumn, sortOrder)
        
        self.setUpdatesEnabled(True)
        self.blockSignals(False)
        
        return True
def restoreXml ( self , xml ) : if xml is None : return False self . setUpdatesEnabled ( False ) self . blockSignals ( True ) header = self . header ( ) xcolumns = xml . find ( 'columns' ) if xcolumns is not None : for xcolumn in xcolumns : name = xcolumn . get ( 'name' ) index = self . column ( name ) vindex = int ( xcolumn . get ( 'visualIndex' , index ) ) currvi = header . visualIndex ( index ) if index == - 1 : continue if currvi != vindex : header . moveSection ( currvi , vindex ) self . setColumnHidden ( index , xcolumn . get ( 'hidden' ) == 'True' ) if not self . isColumnHidden ( index ) : width = int ( xcolumn . get ( 'width' , self . columnWidth ( index ) ) ) self . setColumnWidth ( index , width ) headerState = xml . get ( 'headerState' ) if headerState is not None : state = QtCore . QByteArray . fromBase64 ( str ( headerState ) ) self . header ( ) . restoreState ( state ) sortColumn = int ( xml . get ( 'sortColumn' , 0 ) ) sortingEnabled = xml . get ( 'sortingEnabled' ) == 'True' sortOrder = QtCore . Qt . SortOrder ( int ( xml . get ( 'sortOrder' , 0 ) ) ) if sortingEnabled : self . setSortingEnabled ( sortingEnabled ) self . sortByColumn ( sortColumn , sortOrder ) self . setUpdatesEnabled ( True ) self . blockSignals ( False ) return True
Restores properties for this tree widget from the inputed XML.
        
        :param      xml | <xml.etree.ElementTree.Element>
        
        :return     <bool> success