Python Forum
QGraphicsObject at Mouse Position
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QGraphicsObject at Mouse Position
#2
try this

    def setPosition(self, pos):
        self._x = pos.x() - pos.x()/2
        self._y = pos.y() - pos.y()/2
        self.setPos(QPointF(self._x, self._y))
    def mouseMoveEvent(self, event):
        pos = event.pos()
        self._brushItem.setPosition(pos)
Reply


Messages In This Thread
QGraphicsObject at Mouse Position - by _meshman_ - Oct-27-2019, 10:10 AM
RE: QGraphicsObject at Mouse Position - by Axel_Erfurt - Oct-27-2019, 12:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] QSlider jump to mouse click position MegasXLR 2 8,405 May-26-2018, 08:55 AM
Last Post: MegasXLR

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020