def hit_test(self, pos): plot = self.plot() if plot is None: return rect = self.get_text_rect() canvasRect = plot.canvas().contentsRect() xMap = plot.canvasMap(self.xAxis()) yMap = plot.canvasMap(self.yAxis()) x, y = self.get_top_left(xMap, yMap, canvasRect) rct = QRectF(x, y, rect.width(), rect.height()) inside = rct.contains(pos.x(), pos.y()) if inside: return self.click_inside(pos.x() - x, pos.y() - y) else: return 1000.0, None, False, None
def hit_test(self, pos): plot = self.plot() if plot is None: return rect = self.get_text_rect() canvasRect = plot.canvas().contentsRect() xMap = plot.canvasMap(self.xAxis()) yMap = plot.canvasMap(self.yAxis()) x, y = self.get_top_left(xMap, yMap, canvasRect) rct = QRectF(x, y, rect.width(), rect.height()) inside = rct.contains( pos.x(), pos.y()) if inside: return self.click_inside(pos.x()-x, pos.y()-y) else: return 1000.0, None, False, None
def get_text_rect(self): items = self.get_legend_items() TW, TH, _width, _height = self.get_legend_size(items) return QRectF(0.0, 0.0, TW, TH)
def get_text_rect(self): sz = self.text.size() return QRectF(0, 0, sz.width(), sz.height())
def get_text_rect(self): return QRectF(0.0, 0.0, 10., 10.)
def get_bbox(items): r = QRectF() for it in items: r = r.united(it.boundingRect()) return r
def __init__(self, xmin, xmax, ymin, ymax): super(MandelItem, self).__init__(np.zeros((1, 1), np.uint8)) self.bounds = QRectF(QPointF(xmin, ymin), QPointF(xmax, ymax)) self.update_border() self.IMAX = 80 self.set_lut_range([0, self.IMAX])