Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Best approach to simple drag-and-drop component
Forum Update on Monday, May 27th 2025

Best approach to simple drag-and-drop component

Scheduled Pinned Locked Moved Solved Qt for Python
4 Posts 2 Posters 402 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DanielMcQ
    wrote on last edited by DanielMcQ
    #1

    I'm using (the most excellent) PySide2 to create a prototype for a desktop application that will perform some building energy simulations.

    This is a full-on desktop app, no mobile or tablet implementation necessary. So I've started by using widgets, not QML.

    Part of the app will involve a simple "designer" that allows dragging and dropping objects (windows) onto a 2D surface (building facade), allowing resize, reposition, etc ...so I need to create a simple whiteboard-like component for these simple activities. Nothing crazy.

    I'm not sure which classes I should use to develop this part:

    • I've seen videos from Qt staff where they warn against using any QGraphics* classes for new projects, like this one from 2017: https://www.youtube.com/watch?v=WIRRoPxIerc.
    • Meanwhile other videos from Qt staff seem to suggest -- if I'm getting this right -- that using QGraphics* classes is ok for new development, like this one from 2019: https://www.youtube.com/watch?v=c-sLZsR0Q3w.

    Any suggestions for how to approach the drag-and-drop designer part of my app? All in on QGraphics* classes? Develop in QML and add to main application via QQuickWidget? Something else?

    Very new to Qt so I could be missing alternatives, or even imagining a delimma where there isn't one, due to my ignorance. Perhaps there are existing components or third party solutions which fit this requirement well.

    Thanks for any thoughts!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Do you need some fancy animation for your editor ? If so, then QtQuick is worth investigating. If not then you'll likely have everything you need with the graphics view framework.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • D Offline
        D Offline
        DanielMcQ
        wrote on last edited by DanielMcQ
        #3

        Hi @SGaist Thanks for the response. That's good to hear! At first read it looked like the QGraphics* classes had a lot of the functionality I needed (including capacity to handle transformations, zooming, grouping, etc. etc.) so I was disheartened to get the impression it was all going away...meanwhile I don't think the same amount of infrastructure is available in QML.

        So my working assumption is now -- based on your response and that second video I linked to -- that graphics view framework is the superior approach for desktop-only, and it will continue to be a supported solution for some time to come.

        And no, not planning any fancy animations, so all in with widgets and graphics view framework!

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DanielMcQ
          wrote on last edited by DanielMcQ
          #4

          @SGaist A follow-up question.

          It seems PySide2 and widgets are a good way forward. However, if the UI needs to render a very simple, static (and boring) 3D model, like a small abstract house, is the best approach to use QML within a QQuickWidget, as shown here? https://doc.qt.io/qtforpython/overviews/qt3d-widgets-scene3d-example.html#qt-3d-scene3d-qml-with-widgets-example

          Or is there another approach that would keep the 3D construction and rendering simple and basic to match the simplicity of the intended use. Perhaps using QOpenGLWidget?

          Thanks for any thoughts!

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved