PyQt5/PyQt

How do I implement my own custom element for QGraphicsScene?

Aleksandr34nov opened this issue · 1 comments

Environment : / 环境

  • OS: [e.g. Win 10]
  • Python [e.g. 3.6.4 X64]
  • PyQt5 [e.g. 5.10.1]

Hello
I am implementing a program for rendering various objects. I use QGraphicsView together with QGraphicsScene for rendering.

I need to implement the rendering of my own custom element. One of these elements is the scale in the photo below:
Scale

How can this be done? Maybe there are examples of the implementation of any custom elements? There is an idea to inherit QGraphicsRectItem for a custom element class, but I don't really understand which methods need to be redefined and which conditions need to be met. I would be very grateful for an example of some custom element. Or would it be better to inherit some other class?