<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[The enterEvent and leaveEvent of QGraphicsView do not match the actual show area well]]></title><description><![CDATA[<p dir="auto">I'm using PySide6. I created a custom QGraphicsView  and I rewrite the enterEvent () function and the leaveEvent() function. But the actual working area does not match the visual area.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/83957ddd-4be8-43fb-bd7f-6ba9326a871a.gif" alt="ezgif.com-gif-maker.gif" class=" img-fluid img-markdown" /><br />
Parts of the code:</p>
<pre><code>class LossCurve(QGraphicsView):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setScene(QGraphicsScene(self))
        self.setDragMode(QGraphicsView.NoDrag)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setRenderHint(QPainter.Antialiasing)

        self.chart = QChart()
        self.chart.setAcceptHoverEvents(True)
        self.chart.legend().hide()
        self.series = QLineSeries()
        self.chart.addSeries(self.series)

        self.x_axis = QValueAxis()
        self.x_axis.setLabelFormat("%i")
        self.y_axis = QValueAxis()

        self.chart.addAxis(self.x_axis, Qt.AlignBottom)
        self.series.attachAxis(self.x_axis)
        self.chart.addAxis(self.y_axis, Qt.AlignLeft)
        self.series.attachAxis(self.y_axis)

        self.scene().addItem(self.chart)

        self.x_legend = QGraphicsSimpleTextItem(self.chart)
        self.x_legend_text = '轮：'
        self.x_legend.setText(self.x_legend_text)
        self.y_legend = QGraphicsSimpleTextItem(self.chart)
        self.y_legend_text = '损失：'
        self.y_legend.setText(self.y_legend_text)

        self._callouts = []
        self._tooltip = Callout(self.chart)

        # self.series.clicked.connect(self.keep_callout) 
        self.series.hovered.connect(self.draw_tooltip)
        self.setMouseTracking(True)

    def enterEvent(self, event):
        print('enter........')

    def leaveEvent(self, event):
        print('leave........')
</code></pre>
]]></description><link>https://forum.qt.io/topic/129732/the-enterevent-and-leaveevent-of-qgraphicsview-do-not-match-the-actual-show-area-well</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 04:09:16 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/129732.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 25 Aug 2021 09:42:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to The enterEvent and leaveEvent of QGraphicsView do not match the actual show area well on Thu, 26 Aug 2021 02:35:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/eyllanesc">@<bdi>eyllanesc</bdi></a>  I found the reason. The two arrows are in a hoverd window and the window is frameless and has a transparent background. The real window size is showed in the below picture. So it affects the activation area of the <code>QGraphicsView</code>.</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/2d2c2046-6432-496b-b39b-2245ad609640.png" alt="屏幕截图 2021-08-26 102853.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/677863</link><guid isPermaLink="true">https://forum.qt.io/post/677863</guid><dc:creator><![CDATA[feiyuhuahuo]]></dc:creator><pubDate>Thu, 26 Aug 2021 02:35:25 GMT</pubDate></item><item><title><![CDATA[Reply to The enterEvent and leaveEvent of QGraphicsView do not match the actual show area well on Wed, 25 Aug 2021 19:25:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/feiyuhuahuo">@<bdi>feiyuhuahuo</bdi></a> I do not reproduce the problem, could you provide a complete and verifiable example. In my test I had to remove the callout code. I use Linux with PySide6 6.1.2</p>
]]></description><link>https://forum.qt.io/post/677817</link><guid isPermaLink="true">https://forum.qt.io/post/677817</guid><dc:creator><![CDATA[eyllanesc]]></dc:creator><pubDate>Wed, 25 Aug 2021 19:25:58 GMT</pubDate></item><item><title><![CDATA[Reply to The enterEvent and leaveEvent of QGraphicsView do not match the actual show area well on Wed, 25 Aug 2021 19:17:49 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Do you have the same issue with an empty scene ?</p>
<p dir="auto">Which exact version of PySide6 are you using ?<br />
On which platform ?<br />
How did you install it ?</p>
]]></description><link>https://forum.qt.io/post/677812</link><guid isPermaLink="true">https://forum.qt.io/post/677812</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 25 Aug 2021 19:17:49 GMT</pubDate></item></channel></rss>