Returns the query this widget is representing from the tree widget.
        
        :return     <Query> || <QueryCompound> || None

def query( self ):
        """
        Returns the query this widget is representing from the tree widget.
        
        :return     <Query> || <QueryCompound> || None
        """
        # build a query if not searching all
        q        = Q()
        operator = 'and'
        
        for i in range(self.uiQueryTREE.topLevelItemCount()):
            item = self.uiQueryTREE.topLevelItem(i)
            
            if ( isinstance(item, XQueryItem) ):
                if ( operator == 'and' ):
                    q &= item.query()
                else:
                    q |= item.query()
            else:
                operator = nativestring(item.text(0))
        return q