Closed Aleksandr34nov closed 1 year ago
Sorry, I'm not very clear about your description.
if you want like this:
add this code view.setDragMode(QGraphicsView.RubberBandDrag)
here is a good project to study
Sorry, I'm not very clear about your description. if you want like this: add this code
view.setDragMode(QGraphicsView.RubberBandDrag)
I'm sorry I didn't make myself clear enough. I need a menu bar that is located outside the scene from where I can take a shape and drag it onto the scene by mouse. As in the Paint program or drawio. Menu with shapes in the graphic editor.
Sorry, I'm not very clear about your description. if you want like this: add this code
view.setDragMode(QGraphicsView.RubberBandDrag)
I try to explain again. I am trying to implement a graphic editor. As a canvas for drawing, I use QGraphicsScene together with QGraphicsView.
There was a problem with the implementation of the panel, which is essentially a menu of shapes, from where it would be possible to drag shapes to QGraphicsView. It is located outside of QGraphicsView. I would also like this menu to be divided into several sections so that they can be opened and closed by a button.
Is there an example of implementing this custom shapes menu? Or maybe thoughts with which it can be implemented?
This gif is the example of how I would like it to work (I use drawio as an example):
@Aleksandr34nov
QTreeView
and QListView
icon model to show different icon.event.mimeData()
typeI will write simple example latter
https://github.com/PyQt5/PyQt/blob/master/QGraphicsView/DragGraphics.py like this?
Yes, this is what I need. Thank you very much.
Environment : / 环境
I'm designing graphic editor. As a scene for drawing, I need to use exactly QGraphicsScene. I implemented adding rectangles and ellipses to the scene with two buttons.
I need to implement dragging the faigures from the panel to the canvas, approximately as in the picture:
What widgets or buttons can I use for this custom panel? Maybe there is an information an example with the implementation of a similar panel?
The program code with the implementation of adding shapes: