Giter VIP home page Giter VIP logo

Comments (8)

892768447 avatar 892768447 commented on June 16, 2024

Sorry, I'm not very clear about your description.
if you want like this:
add this code view.setDragMode(QGraphicsView.RubberBandDrag)
无标题

from pyqt.

892768447 avatar 892768447 commented on June 16, 2024

here is a good project to study

https://github.com/jchanvfx/NodeGraphQt

from pyqt.

Aleksandr34nov avatar Aleksandr34nov commented on June 16, 2024

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.
F67CAA19-2057-4A68-A45F-C598006DA794

from pyqt.

Aleksandr34nov avatar Aleksandr34nov commented on June 16, 2024

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):
Shape_menu

from pyqt.

892768447 avatar 892768447 commented on June 16, 2024

@Aleksandr34nov

  1. for left panel, you can use QTreeView and QListView icon model to show different icon.
  2. you can see this example draggableicons to solve drag from left and drop on the right.
  3. when drop on the right, You can determine which type of graph is based on the event.mimeData() type

from pyqt.

892768447 avatar 892768447 commented on June 16, 2024

I will write simple example latter

from pyqt.

892768447 avatar 892768447 commented on June 16, 2024

https://github.com/PyQt5/PyQt/blob/master/QGraphicsView/DragGraphics.py
like this?
DragGraphics

from pyqt.

Aleksandr34nov avatar Aleksandr34nov commented on June 16, 2024

https://github.com/PyQt5/PyQt/blob/master/QGraphicsView/DragGraphics.py
like this?
DragGraphics

Yes, this is what I need. Thank you very much.

from pyqt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.