How to implement mouse dragging an object function with QGraphicsView class | PyQt5 Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ธ.ค. 2024

ความคิดเห็น • 19

  • @arslansiddique32
    @arslansiddique32 2 ปีที่แล้ว +1

    Was struggling quite a lot for dragging QGraphicsTextItem. This is exactly what I need and it worked. Thanks.

  • @411tomas411
    @411tomas411 4 ปีที่แล้ว +4

    This is exactlty what I've been struggling to do! Thank you very much for sharing, greetings from Chile!

    • @jiejenn
      @jiejenn  4 ปีที่แล้ว

      Glad my video helped.

    • @vamsikartik3389
      @vamsikartik3389 3 ปีที่แล้ว

      @@jiejenn I have been browsing for almost an hour and found this. Thanks for sharing.
      Instead of updating position by using that algorithm in mouseMoveEvent.
      Just do:
      self.setFlag(self.ItemIsMovable, True) in def __init__()
      and add
      return super().mouseMoveEvent(event) at the bottom of mouseMoveEvent function. It works.
      Thanks

  • @hugocroizer1385
    @hugocroizer1385 3 ปีที่แล้ว +1

    Thank you very much for this clear video ! I just didn't understand where the app came from in the point class method so I replaced it with self.parent where parent is a Qwidget holding the QGraphicsScene. Thank you again !

  • @rules654
    @rules654 4 ปีที่แล้ว

    Exactly what i was looking for ....thanks from India

  • @danielmartinmateos8597
    @danielmartinmateos8597 3 ปีที่แล้ว

    I was looking for a solution like that for my dissertation application
    Thanks a lot!!

  • @morths-design
    @morths-design ปีที่แล้ว

    Thank you for this tutorial. It will save me a lot of time 🙂

  • @Postermaestro
    @Postermaestro ปีที่แล้ว

    minimal working example, great!

  • @hamidthephysicist6376
    @hamidthephysicist6376 4 ปีที่แล้ว

    Thank you very much very interesting tricks . But If I want to "create multiple items" and you can select and move more than one item at a time ? I can't do it with this method ?

  • @Cephalopopo
    @Cephalopopo 3 ปีที่แล้ว

    thank you this is very helpful!

  • @vickycodex4975
    @vickycodex4975 2 ปีที่แล้ว

    Nice video!, I am making a program which should do the same but with an image, is it possible?

  • @fransflorenza9708
    @fransflorenza9708 2 ปีที่แล้ว

    i have some question. first, does the coordinate is the coordinate of the cursor and not the center coordinate of the object?. second, what if the object is triangle and we need to get heading of the object by the value of 0 - 360 degree?

  • @hyunew
    @hyunew 3 ปีที่แล้ว

    how can i get mouse position on image that i load by pyqt5?

  • @P_and_M
    @P_and_M 2 ปีที่แล้ว

    Thanks for the tutorial, I have a question, how can I draw a set of points given in tuples for exaple, like points belonging to a function like y=x^2?

    • @P_and_M
      @P_and_M 2 ปีที่แล้ว

      how can I move more than one object?

  • @fire17102
    @fire17102 3 ปีที่แล้ว

    This is fantastic
    How can i do this in 3d though?

  • @zackbarnett7047
    @zackbarnett7047 4 ปีที่แล้ว

    do I need to download code for the from PyQt5.QtWidgets to work but my computer just says it doesn't exist?

    • @jiejenn
      @jiejenn  4 ปีที่แล้ว

      Have you installed PyQt5 Python package first?