def getAbsoluteRect(self, node): absoluteRect = CRect() temp_rect = CRect() current_node = CTreeNode() current_node = copy.deepcopy(node) temp_rect = current_node.mRect while True: parent_node = CTreeNode() if None == current_node.mParentNode: break else: parent_node = current_node.mParentNode temp_rect.mLeft += (parent_node.mRect.mLeft - parent_node.mScrollX) temp_rect.mTop += (parent_node.mRect.mTop - parent_node.mScrollY) current_node = parent_node temp_rect.mRight = temp_rect.mLeft + (node.mRect.mRight - node.mRect.mLeft) temp_rect.mBottom = temp_rect.mTop + (node.mRect.mBottom - node.mRect.mTop) absoluteRect = temp_rect return absoluteRect
def getRectArea(self): rect = CRect() rect.mTop = self.top rect.mBottom = self.bottom rect.mLeft = self.left rect.mRight = self.right return rect
def getAbsoluteRect(self, node): absoluteRect = CRect() temp_rect = CRect() current_node = CTreeNode() current_node = copy.deepcopy(node) temp_rect=current_node.mRect while True: parent_node = CTreeNode() if None == current_node.mParentNode: break else: parent_node = current_node.mParentNode temp_rect.mLeft += (parent_node.mRect.mLeft - parent_node.mScrollX) temp_rect.mTop += (parent_node.mRect.mTop - parent_node.mScrollY) current_node = parent_node temp_rect.mRight = temp_rect.mLeft + (node.mRect.mRight - node.mRect.mLeft) temp_rect.mBottom = temp_rect.mTop + (node.mRect.mBottom - node.mRect.mTop) absoluteRect=temp_rect return absoluteRect