def helpEvent(self, event: QGraphicsSceneHelpEvent): idx = self.indexAt(self.mapFromScene(event.scenePos())) if idx is not None: rect = self.__textitems[idx].sceneBoundingRect() viewport = event.widget() view = viewport.parentWidget() rect = view.mapFromScene(rect).boundingRect() QToolTip.showText(event.screenPos(), self.__items[idx], view, rect) event.setAccepted(True)
def help_event(self, ev: QGraphicsSceneHelpEvent) -> bool: if self.marg_prob_item is None: return False index = self.__get_index_at( self.marg_prob_item.mapFromScene(ev.scenePos())) if index is not None: QToolTip.showText(ev.screenPos(), self.labels[index], widget=self) return True return False
def graphicsscene_help_event(scene: QGraphicsScene, event: QGraphicsSceneHelpEvent) -> None: """ Send the help event to every graphics item that is under the `event` scene position. """ widget = event.widget() if widget is not None and isinstance(widget.parentWidget(), QGraphicsView): view = widget.parentWidget() deviceTransform = view.viewportTransform() else: deviceTransform = QTransform() items = scene.items( event.scenePos(), Qt.IntersectsItemShape, Qt.DescendingOrder, deviceTransform, ) text = "" event.setAccepted(False) for item in items: scene.sendEvent(item, event) if event.isAccepted(): return elif item.toolTip(): text = item.toolTip() break QToolTip.showText(event.screenPos(), text, event.widget()) event.setAccepted(bool(text))
def help_event(self, ev: QGraphicsSceneHelpEvent): if self.bar_item is None: return False index = self.__get_index_at(self.bar_item.mapFromScene(ev.scenePos())) text = "" if index is not None: text = self.master.get_tooltip(index) if text: QToolTip.showText(ev.screenPos(), text, widget=self) return True else: return False
def helpEvent(self, event: QGraphicsSceneHelpEvent): pos = self.mapFromScene(event.scenePos()) item = self.__itemDataAtPos(pos) if item is None: return data, index, rect = item if data.rownames is None: return ttip = data.rownames[index] if ttip: view = event.widget().parentWidget() rect = view.mapFromScene(self.mapToScene(rect)).boundingRect() show_tool_tip(event.screenPos(), ttip, event.widget(), rect) event.setAccepted(True)